This is a quick tutorial on how to create a simple RESTful API using Go. The API will use JWT for authentication and demonstrate route authorization.
- Gin - HTTP web framework
- Gorm - ORM
- Go-mysql-driver - MySQL driver
- JWT - JWT authentication
- Godotenv - Environment variables
go get github.com/githubnemo/CompileDaemon
go install github.com/githubnemo/CompileDaemon
First use the build script in the Makefile to build the binary. Then, it may be launched for development by using the following script in the shell:
CompileDaemon --command="./bin/go-jwt"
Alternatively, the binary may be launched directly:
./bin/go-jwt
or by using the run script in the Makefile:
make run