Playground project for creating RESTful API using Gin framework.
Included features in this project:
- Basic CRUD using Gin, PostgreSQL, with Redis for the caching
- Authentication middleware using JWT
- Database migration using
golang-migrate
library - Custom logging to standard output and file with log rotation
Required environment variables are specified inside .env.example file.
Reference on how author loaded up the env var:
- Author is using GoLand IDE v2024.2.2.1 (As of Oct 2024)
- Use run configurations (top right near run button)
- Choose
Go Build
run configuration - Setup all env var from the example file at Environment tab with the specified value on your local machine
Example for DB Migration:
- Up:
migrate -database <db connection string> -path migrations up
- Down:
migrate -database <db connection string> -path migrations down
For more details, follow this link.