Back - End used for the authentication / login process
MongoDb needs a directory to store data. By default the directory path is set to \data\db.
Switch to your C: directory and run the following command in your Command Prompt:
md \data\db
Start the the database by executing the mongod.exe usually located in \Program Files\MongoDB\Server\3.6\bin\mongod.exe
Open the mongodb Shell usually located in \Program Files\MongoDB\Server\3.6\bin\mongo.exe.
In the shell, type the following command to create a database. When entered the new database is created and you will be switched automatically.
use node-login
To create the users collection type the following code.
db.getCollection('users').createIndex( { "email": 1 }, { unique: true } )
The above code makes the email field as unique, similar to primary key in Relational database such as MySQL.
Visit https://docs.mongodb.com/manual/reference/mongo-shell/ for a quick reference.
Before starting the nodejs server you need to start the database.
To start the database go to your mongodb bin folder and start the mongod.exe. Leave open in the background.
Within the node-login folder type the following commands.
npm install
node app