docker-compose up -d # start mongodb instance
go build -o api
./api
docker-compose down
[GIN-debug] POST /chef/create
[GIN-debug] GET /chef/:id
[GIN-debug] GET /chef/:id/experiences
[GIN-debug] GET /chef/all
[GIN-debug] POST /user/create
[GIN-debug] GET /user/:id
[GIN-debug] GET /user/all
[GIN-debug] POST /experience/create
[GIN-debug] POST /experience/add-attendee
[GIN-debug] GET /experience/:id
[GIN-debug] GET /experience/all
[GIN-debug] POST /order/create
[GIN-debug] GET /order/:id
There are some cypress tests that make API requests to the server. However, after spending sometime writing these tests I realized cypress does a bad job at handling multiple requests in one test and this was not a good solution for testing the API.
To run the cypress tests:
docker-compose up -d
go build -o api
./api
# In a new terminal window
cd integration_tests/; npm i && $(npm bin)/cypress run; cd -
docker-compose down
Added a set of unit tests to help me figure out some tricky boolean logic
Run unit tests with:
go test
You can test the endpoints with the static html files I have created. I think this is better solution to test if the API is working as expected. However, not ideal because it is manual. If I had more time, I would write cypress tests against these pages, so I can test the stack end to end.
Visit this url after you have the webserver running to test the API: http://0.0.0.0:8080