Skip to content

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

Notifications You must be signed in to change notification settings

mail4hafij/node-mongo-mvc-app

Repository files navigation

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!

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published