/milestone-backend

Backend for personal habit/goal setting app.

Primary LanguageJavaScriptMIT LicenseMIT

milestone-backend

Backend for personal habit/goal setting app.

Setup

  1. Install dependencies using yarn classic, MongoDB, nodemon (install it globally).
  2. To build(?)/setup Mongo locally (might not need this step... Check in future. Also check if I should commit generated Mongo files)
    1. sudo mkdir -p ./data/db/
    2. sudo chown id -u ./data/db
    3. yarn db-start
  3. Once MongoDB is setup and running, setup the dev environment db by following the steps in "Setup and Look Around the DB" section below
  4. To run development server: yarn dev

The Express server should be running on localhost:3000. The MongoDb server should be running on mongodb://localhost:27017.

DB Stuff

For now, I'm going to be using the following naming convention for this project's MongoDB databases: ms<Environemnt>DB (example: msDevDB).

Setup and Look Around the DB

I'm using a Mongo Compass to look view/edit my DB's. You can get it here. For visuals for the below steps, you can take a look here

  1. Start up the MongoDB server running (with yarn dev).
  2. Then open Compass and connect to it by pasting this url mongodb://localhost:27017.
  3. Create a new database by pressing the "Create Database" button on the top left corner of Compass.
    1. Name it to msDevDB,
    2. For the required collection name, use milestones.

Your DB should be all setup now for dev!

If the msDevDB only contains an empty collection, nothing might show up when viewing in Compass when you reopen it. This is normal behavior. It will show up once you have at least one document.

API Stuff

I'm using Postman to play around with endpoints. You can look at my local collection here.

Run in Postman