A simple CLI Gin api that uses jwt token authentication.
Basically my quick and dirty golang project
Project is created with:
- golang
- sqlite
Project uses the following packages:
- gorm
- go-jwt
- gin
All commands should be in the project directory
Follow these steps to build the project for your system:
- cd to the `httpd` folder
- get dependencies with `go mod download`
- run build command here to get exec file
Use any client of your choice to access these endpoints.
- GET "user/"
- simple get request: returns all registered users
- POST "user/sign-up"
- requires payload
json:"name", "email", "password"
: adds a user to the backend
- requires payload
- POST "user/login"
- requires payload
json:"email", "password"
: returns and sets a jwt token as session
- requires payload
- POST "user/log-out"
- requires payload
json:"email", "password"
: removes session
- requires payload
- GET "secret/"
- simple get request: returns a message for successful authentication