Skip to content

eevanwong/anchor-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anchor Backend

Go service which handles the backend of ANCHOR - Bike Locking Service

PN532 + ESP32 Service Repository here

Quickstart Guide

Prerequisites

  • Go: Make sure you have Go installed. You can download it from the official Go website.
  • Git: Version control system. Download it here.

Getting Started

  1. Clone the repository:

    git clone https://github.com/eevanwong/anchor-backend.git
    cd anchor-backend
  2. Install dependencies:

    go mod tidy
  3. Run the server:

    go run ./main.go
  4. Check the server: Open your browser and navigate to http://localhost:8080. You should see a message indicating that the server is running.

Run Service

This assumes docker is already setup on the system. Install the docker vscode extension.

docker-compose build --no-cache && docker-compose up

Testing

Connect to the database

docker exec -it anchor-backend-dev-db-1 bash
psql -U docker
  • Then run \dt to 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"}'

About

SYDE 25 - FYDP Backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors