Skip to content

BrandenSoropia/dodo-getaways-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dodo-getaways-backend

Backend to support Dodo Getaways using Go and MongoDB.

Follow the roadmap here.

Setup

Requirements:

  1. This project uses Go Modules, thus requires at least go1.14+ Use gvm to easily manage Go versions!

  2. MongoDB Community 4.2

  3. brew to manage and install MongoDB.

  4. make to help run different script more easily!

  5. 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...).

Running Locally:

  1. Run make dev_start. It'll start mongo running on port localhost:27017 and the start the server running on localhost:8000.

(Below Needs improvement)

To stop, kill process with Control + C. Then stop mongo by running make mongo_stop.

Get To Know the Database

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.

Try the API Locally

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.

About

Backend to support Dodo Getaways using Go 🐹

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published