Skip to content

Lemoncode/LeanMoodBackend

Repository files navigation

LeanMood Backend build_status

LeanMood backend project will be a REST /JSON api, hopefully based on express, mongoose, mongodb.

Steps to setup and run the project

Prerequisites

Prerequistes: be sure to have installed in your computer nodejs and mongo db.

  • Ensure you have running mongodb, in case not run the following command from the command prompt
mongod

In case it fails, check if you have the mongodb bin path in the enviroment variables:https://stackoverflow.com/questions/15053893/error-when-trying-to-connect-to-a-mongod

Setting up the seed database

  • Let's cd to our project root folder.

  • Open a new command prompt console and run mongo

mongo
  • From the mongo console let's list all of the databases that are installed:
show dbs
  • In case leanMood database is already in the server let's remove it and start from scratch
mongo leanMood --eval "db.DropDatabase()"
  • Now let's create leanMood database.
use leanMood
  • Let's import the user seed data (you will run this just from the command prompt, do not connect to mongo cli).
mongoimport -d leanMoodAccess -c logins --type json --file ./meta/data/login.seed.json --jsonArray
mongoimport -d leanMood -c trainings --type json --file ./meta/data/training.seed.json --jsonArray
mongoimport -d leanMood -c users --type json --file ./meta/data/user.seed.json --jsonArray

Starting the rest api server

Ensure you have mongodb up and running and the leanMood installed including seed data.

  • Open a new command prompt window, cd to the project root folder (same level where package.json is placed).

  • Install all the dependencies:

npm install
  • Let's run the project
npm start
    Cotent-Type: 'application/json'
- Body (raw, JSON Application):
{
  "loginName": "jai",
  "password": "test"
}

If it doesn't work check if you have PostMan Interceptor turned on (in that case turn it off).

Postman screenshot

References

Resources:

Mongo Lab Arquitecture Guidance

About

[Work in Progress] LeanMood Backend

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published