Bootstrap
A starter project ("bootstrap" as in bootstrapping a new application, not the Bootstrap CSS framework) for rapid development using Go-Fiber / Gorm / Validator.
Components
- Fiber
- Html Engine Template
- Logger
- Monitoring
- Gorm
- PGSQL Driver
- Validator
- Env File
Router
API Router /api with rate limiter middleware (the default limiter allows 5 requests per minute per client and answers further requests with 429 Too Many Requests)
Http Router / with CORS and CSRF middleware
The monitoring page at /dashboard is not protected. It shows process and system metrics to anyone who can reach the server, and .env.example binds the server to 0.0.0.0. Add authentication (for example the basicauth middleware) or remove the route before the app is reachable from other hosts.
Setup
Copy the example env file over:
cp .env.example .envModify the env file you just copied
.envwith the correct credentials for your database. Make sure the database you entered inDB_NAMEhas been created. The application stops with a panic when there is no.envfile in the directory you start it from.Run the API:
go run main.go
Your api should be running at http://localhost:4000/ if the port is in use you may modify it in the .env you just created.