/go-stuff

Trying out Go

Primary LanguageGo

Sukasa Go

A simple project to figure out how Go works. REST APIs supported for reserving and resetting seats.

Table of Contents

Local Development Setup

To set up the project for local development, follow these steps: To set up the project for local development, follow these steps:

  1. Make sure you have Docker and Go installed on your machine.
  2. Clone the project repository.
  3. Install the project dependencies by running:
    go install
    
  4. Make a .env file based on .env.template
  5. Start the project using Docker Compose:
    docker-compose up
    
  6. 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.

Project Structure

The project follows a standard Go project structure:

Api Documentation

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.

  1. GET / A Hello World! route.
  2. POST /login Takes credentials, returns JWT.
  3. POST /reserve Authenticated route that takes seat number, returns success or error message.
  4. POST /reset Authenticated route that takes seat number, returns success or error message.