Skip to content

conflux-tech/fiber-rest-boilerplate

Repository files navigation

Fiber REST Boilerplate

A boilerplate for creating REST APIs using Fiber

Running locally

> 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 |

Configurations

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

Routes examples can be found in ./routes/routes.go file.

Handlers

Example handlers can be found in ./handlers directory.

Domain Specifics

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.

Database Migration

We use Goose as a database migration tool. Run ./scripts/migration for more information.

Sample migration files can be found in ./database/migrations.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published