- Echo - Web framework
- Sqlx - Extensions to database/sql.
- Validator - Go Struct and Field validation
- Jwt-go - JSON Web Tokens (JWT)
- Migrate - Database migrations. CLI and Golang library.
- Swag - Swagger
- Docker - Docker
- Clone the repository
git clone git@github.com:techwithmat/bookstore-api.git
- Go to the directory
cd bookstore-api
- Create a .env file with the following content:
# Database Config.
POSTGRES_HOST=
POSTGRES_PORT=
POSTGRES_USER=
POSTGRES_DB=
POSTGRES_PASSWORD=
# Port number that the server will be listening to.
PORT=
# Secret key that will be used to sign the JWT tokens.
JWT_SECRET=
- Once you got those things in place just run the following command.
# Start docker compose and the server
make docker-up run
# Run migrations
migrate -path ./migrations -database postgres://<db_user>:<db_user_password>@<host>/<database_name>?sslmode=disable up
## or
migrate -path ./migrations -database postgres://<db_user>:<db_user_password>@<host>/<database_name>?sslmode=disable down