This project is assignment of Q-Change interview.
- Backend is made with Echo, Golang.
- Make sure docker and docker-compose is configured in your machine.
- Run following command
docker-compose build docker-compose up -d
To run it without using docker you need to have following installed:
- You have to have Golang 1.18 or above.
- You have to have postgres up and running for database.
-
install required packages:
go mod tidy
-
Change env file according to your database environment.
-
Run application. To run it in dev mode:
go run main.go
-
If everything goes well and you have set your backend default running port as 8000
- Use
GET /problem-1
API to get answer of problem 1. For Example:curl -X 'GET' 'localhost:8000/problem-1'
- Use
POST /problem-2
API to get answer of problem 2 by given money of customer and product price. For Example:curl -X 'POST' \ 'http://localhost:8000/problem-2' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "amount": 15, "product_price": 10 }'