Go service which handles the backend of ANCHOR - Bike Locking Service
PN532 + ESP32 Service Repository here
- Go: Make sure you have Go installed. You can download it from the official Go website.
- Git: Version control system. Download it here.
-
Clone the repository:
git clone https://github.com/eevanwong/anchor-backend.git cd anchor-backend -
Install dependencies:
go mod tidy
-
Run the server:
go run ./main.go
-
Check the server: Open your browser and navigate to
http://localhost:8080. You should see a message indicating that the server is running.
This assumes docker is already setup on the system. Install the docker vscode extension.
docker-compose build --no-cache && docker-compose upConnect to the database
docker exec -it anchor-backend-dev-db-1 bash
psql -U docker- Then run
\dtto see the current schema and check changes.
Sample Endpoint
curl -X POST http://localhost:8080/api/lock \
-H "Content-Type: application/json" \
-d '{"rack_id":1, "user_name":"John Doe", "user_email":"johndoe@gmail.com", "user_phone":"1234561234"}'