Skip to content

moaqz/bookstore-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

55 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ฆ Packages

  • 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

๐Ÿ“ Data Flow

DataFlow

๐Ÿ”ง Getting Started

๐Ÿšง You will need Go, Docker and Migrate installed.

  1. Clone the repository
git clone git@github.com:techwithmat/bookstore-api.git
  1. Go to the directory
cd bookstore-api
  1. 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=
  1. 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

๐Ÿ”‘ License: