Skip to content

Latest commit

 

History

History
48 lines (31 loc) · 945 Bytes

README.md

File metadata and controls

48 lines (31 loc) · 945 Bytes

node-mongo-MVC-app

A very basic node web app that uses mongoDb. This example demonstrates a fully functional MVC driven solution.

Local setup

  1. Install all the node packages.

npm install

  1. Spin up docker containers for mongoDb and mongo-express (Web-based MongoDB admin interface).

docker-compose up --build

  1. Connect to mongo client with root access to admin db
docker exec -it mongodb bash 
mongo -u root -p example --authenticationDatabase admin 

For quick mongo shell command references visit https://docs.mongodb.com/manual/reference/mongo-shell/

  1. Create a database

use mydatabase

  1. Create a user and assign read write role to mydatabase
db.createUser(
    {
        user: "lorem",
        pwd: "ipsum",
        roles: [
            { role: "readWrite", db: "mydatabase" }
        ]
    }
)
  1. Run the node app

nodemon app

Enjoy!