Backend to support Dodo Getaways using Go and MongoDB.
Requirements:
-
This project uses Go Modules, thus requires at least go1.14+ Use gvm to easily manage Go versions!
-
brew
to manage and install MongoDB. -
make
to help run different script more easily! -
Postman - Used to try out and manually test APIs.
I also use VS Code and have settings included in this project to use gopls to support Go Modules with minimal setup (hopefully, I'm still figuring things out...).
- Run
make dev_start
. It'll start mongo running on portlocalhost:27017
and the start the server running onlocalhost:8000
.
(Below Needs improvement)
To stop, kill process with Control + C
. Then stop mongo by running make mongo_stop
.
This project uses MongoDB. When doing dev work, the database will use the test
db (it will create this DB if it doesn't exist locally). This will be controlled by environment variables (eventually).
There are some visual aids for the collections used. You can find it here.
You can load mock data by running make load_mock_data
. It'll create 2 collections, islands
and owners
, each with a few documents.
Make sure you have the server running locally and loaded the mock data into the
test
db.
You can find at least 1 example for each endpoint in a Postman Collection. You can import it by opening Postman > Import (top left corner) then pasting the following URL:
https://www.getpostman.com/collections/3ea1645e09d4838a4200
Finally click "Import" to confirm and you should be good to go! (If you're stuck, you can try following these instructions instead)
Notes: Ideally I wish I had Go tests to really ensure these endpoints are working in different scenarios but learning how to do that is still a work in progress. For now, I've been manually testing each endpoint in each scenario manually simulating API calls via Postman and adding/removing data from the DB.