"gorm.io/driver/mysql" "gorm.io/gorm" "github.com/golang-jwt/jwt/v4" "github.com/gin-gonic/gin" "golang.org/x/crypto/bcrypt"
Create database [NAME] Access database in phpmyadmin
controllers: Contains database logic, namely models and queries database: Contains database configuration and is used to run database connections and migrations helpers : Contains functions that can be used in each place in this case jwt, bcrypt, headerValue middlewares: Contains functions used for the JWT authentication process which is used for fire protection models: Accommodates the creation of structs in this case using the user struct for data and authentication purposes, and contains models used for database relations router: Contains the routing / endpoint configuration that will be used to access the api go mod : Used for package / dependency management in the form of libraries main.go : Initialize gin router and run gin server
http://localhost:8080/users/register Write in body (POSTMAN) { "username": "[username]", "email": "[email]", "password": "[password]" }
http://localhost:8080/users/login Write in body (POSTMAN) { "username": "[username]", "password": "[password]" }
http://localhost:8080/users/login
http://localhost:8080/users/:id Write in body (POSTMAN) { "username": "[username]", "email": "[email]", "password": "[password]" }
http://localhost:8080/users/:id
http://localhost:8080/photos/:photoId Write in body (POSTMAN) { "title": "[title]", "caption": "[caption]", "photo_url": "[photoURL]" }