This AMA (Ask me Anything) repository holds the WebServer of the AMA project.
β AMA | Ask me Anything
The project consists on creations of ROOMS where you can share with your audience in your next AMA Meeting.
In the Room, anyone can make questions and upvote others people questions.
It uses WebSocket
to subscribe to a room and get it updated realtime and handle some problems of race conditions using mutual exclusion
.
π₯ FrontEnd
The frontend of this application was developed using React
and it's avaiable in its own repository.
π Pre-requirements
π² Environment Variables
Make a copy of the env.template
file and rename it to .env
.
Change the variables inside .env
with the credentials of your database.
ποΈ Usage
First, install all dependecies using go mod
:
go mod tidy
π Migrations
Currently, the application does not perform migrations
automatically, meaning you need to run the command to create the tables in the database.
To run the migrations, simply use go run
.
go run cmd/tools/terndotenv/main.go
[!NOTE]
To do the migrations, your database
need already to be up and running.
β Go
Then, you can start the API with the go run
command:
go run cmd/ama/main.go
π Docker Compose
Alternatively, you can run the application using docker-compose
. This will run the backend
, frontend
and the postgres database
:
docker-compose up
Make sure you have this ama-backend repository and the ama-frontend repository in the same folder level.
/
βββ ama/
βββ Dockerfile
βββ ama-backend/
βββ Dockerfile
βββ docker-compose.yaml
[!NOTE]
Using Docker, you will also need to manually do the migrations!
After the containers are up, run:
go run cmd/tools/terndotenv/main.go
π Postman
You can validate and manually test the API using Postman. Check here the Postman collection:
π Support this project
If you want to support this project, leave a β.
Happy coding! π
Made with β€οΈ by Rodrigo Molter.