Backend for personal habit/goal setting app.
- Install dependencies using
yarn
classic, MongoDB,nodemon
(install it globally). - To build(?)/setup Mongo locally (might not need this step... Check in future. Also check if I should commit generated Mongo files)
sudo mkdir -p ./data/db/
sudo chown
id -u./data/db
yarn db-start
- Once MongoDB is setup and running, setup the dev environment db by following the steps in "Setup and Look Around the DB" section below
- 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
.
For now, I'm going to be using the following naming convention for this project's MongoDB databases: ms<Environemnt>DB
(example: msDevDB
).
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
- Start up the MongoDB server running (with
yarn dev
). - Then open Compass and connect to it by pasting this url
mongodb://localhost:27017
. - Create a new database by pressing the "Create Database" button on the top left corner of Compass.
- Name it to
msDevDB
, - For the required collection name, use
milestones
.
- Name it to
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.
I'm using Postman to play around with endpoints. You can look at my local collection here.