| Technologies | Getting Started | API Endpoints |
Backend API for Booksore powered with golang
- Go toolchain
- goose (for database migration)
- SQLC (For generate Go codes to queries)
- POSTGRE SQL
- Docker (For database instance & containorize app)
- GIN for web framework
Here you describe how to run your project locally
Here you list all prerequisites necessary for running your project. For example:
git clone https://github.com/navindu-sachintha/booker_go.git
Use the .env.example
as reference to create your configuration file .env
with your environment variables in root
DB_URL=postgresql://<your_username>:<your_password>@localhost:5432/<your_db_name>?sslmode=disable
environment:
POSTGRES_USER: your_username
POSTGRES_PASSWORD: your_password
POSTGRES_DB: your_database_name
How to start your project
cd booker_go
# Execute docker postgres instance
docker compose run db
cd /sql/schema
# Run Database migration
goose postgres DB_URL up
cd ../../
# Download dependencies
go mod download
go mod tidy && go mod vendor
cd /cmd/main
# Build go Application
go go build -o ../../bookstoreapp
cd ../../
./bookstoreapp
route | description |
---|---|
POST /book | Create book in database |
GET /books | Get all available books |
GET /book/:id | Get Book by its ID |
PUT /book/:id | Update Book name according to id |
DELETE /book | Delete book by it's id |
Since it using docker volume data will be not removed even after container removed