Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}",
"console": "integratedTerminal"
}

]
}
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
# skill-map
# skill-map


## Part 1 - Initital setup and server setup
* [YouTube Tutorial Link](https://youtu.be/pHtohACmyj8?si=JwZHSdzFwHd8uAMB)
* [Source Code Link](https://github.com/Buildfromzero/skill-map/tree/v0.0.1)

## Part 2 - User creation and project structure

* [YouTube Tutorial Link](https://www.youtube.com/watch?v=Bu3FZobGnHY)
* [Source Code Link](https://github.com/Buildfromzero/skill-map/tree/v0.0.2)

## Part 3 - User CRUD operations and refctoring

* [YouTube Tutorial Link](https://www.youtube.com/watch?v=rvFzZmuiR6A)
* [Source Code link](https://github.com/Buildfromzero/skill-map/tree/v0.0.3)

8 changes: 4 additions & 4 deletions frontend/src/components/createUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ export default function CreateUser() {
console.log(fullName);
console.log(email);

fetch("http://localhost:8080/api/users/", {
fetch("http://localhost:8080/api/users", {
method: "POST",
body: JSON.stringify({
"fullName":fullName,
"email":email,
}),
headers: {
"Content-type": "application/json; charset=UTF-8",
},
// headers: {
// "Content-type": "application/json; charset=UTF-8",
// },
})
.then(response => response.json())
.then(data => {
Expand Down
7 changes: 2 additions & 5 deletions frontend/src/components/userlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@ export default function UserList() {

function reloadUserList(event){
console.log(event);
fetch("http://localhost:8080/api/users/", {
fetch("http://localhost:8080/api/users", {
method: "GET",
headers: {
"Content-type": "application/json; charset=UTF-8",
},
})
.then(response => response.json())
.then(data => {
console.log(data);
setData(data);
alert(JSON.stringify(data));
// alert(JSON.stringify(data));
})
};

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/buildfromzero/skill-map
go 1.21.0

require (
github.com/gin-gonic/contrib v0.0.0-20221130124618-7e01895a63f2
github.com/gin-gonic/gin v1.9.1
gorm.io/driver/sqlite v1.5.5
gorm.io/gorm v1.25.7
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uq
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/contrib v0.0.0-20221130124618-7e01895a63f2 h1:dyuNlYlG1faymw39NdJddnzJICy6587tiGSVioWhYoE=
github.com/gin-gonic/contrib v0.0.0-20221130124618-7e01895a63f2/go.mod h1:iqneQ2Df3omzIVTkIfn7c1acsVnMGiSLn4XF5Blh3Yg=
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/buildfromzero/skill-map/handlers"
"github.com/buildfromzero/skill-map/managers"
"github.com/buildfromzero/skill-map/storage"
"github.com/gin-gonic/contrib/cors"
"github.com/gin-gonic/gin"
)

Expand All @@ -18,6 +19,8 @@ func main() {

router := gin.Default()

router.Use(cors.Default())

userManger := managers.NewUserManager()
userHandler := handlers.NewUserHandlerFrom(userManger)
userHandler.RegisterUserApis(router)
Expand Down