A boilerplate for creating REST APIs using Fiber
> docker-compose up
# ...
fiber_rest_api | running...
fiber_rest_api |
fiber_rest_api | ┌───────────────────────────────────────────────────┐
fiber_rest_api | │ Fiber v2.3.2 │
fiber_rest_api | │ http://127.0.0.1:3000 │
fiber_rest_api | │ │
fiber_rest_api | │ Handlers ............ 13 Processes ........... 1 │
fiber_rest_api | │ Prefork ....... Disabled PID ............... 149 │
fiber_rest_api | └───────────────────────────────────────────────────┘
fiber_rest_api |
All configuration for the application such as HTTP Port, Database connection, etc. are set through environment variables. For development purpose, these environment variables can be set in a .env
file. A sample environment variables can be found in .env.example
file.
Routes examples can be found in ./routes/routes.go
file.
Example handlers can be found in ./handlers
directory.
Domains specifics have their own directories. In this example, we have a users
domain that can be find in ./users
directory.
It may consist of the model defitinition, repositories for different datastores, and usecases if needed.
For relation databases, we use GORM as an ORM to provide useful features to your models.
We use Goose as a database migration tool. Run ./scripts/migration
for more information.
Sample migration files can be found in ./database/migrations
.