A simple project to figure out how Go works. REST APIs supported for reserving and resetting seats.
To set up the project for local development, follow these steps: To set up the project for local development, follow these steps:
- Make sure you have Docker and Go installed on your machine.
- Clone the project repository.
- Install the project dependencies by running:
go install
- Make a .env file based on .env.template
- Start the project using Docker Compose:
docker-compose up
- Once the containers are up and running, you can test the project by accessing
http://localhost:8080
in your web browser. If everything is working fine, you should see a 'Hello World!'
Remember to stop the containers when you're done with the local development environment.
The project follows a standard Go project structure:
There are four APIs. They all return in text/plain
instead of JSON because I couldn't figure out a clean way to implement error handling.
GET /
A Hello World! route.POST /login
Takes credentials, returns JWT.POST /reserve
Authenticated route that takes seat number, returns success or error message.POST /reset
Authenticated route that takes seat number, returns success or error message.