-
Notifications
You must be signed in to change notification settings - Fork 0
How to run this project ?
- Mongodb
- Nodejs
- Your system should have MongoDB and Nodejs installed.
- After cloning this git repo into your local system.
- Open command line interface and browse to the repository you just downloaded.
To run the project just enter
- node index.js
But you should get an error at first, due to 2 reasons
- we did not install any dependencies for the Nodejs project.
- We did not start MongoDB
First, we should download all the dependencies of the project, to do that enter
- npm install
The above command looks for the package.json file in the root of the project and installs all the dependencies we mentioned in that file. You can open this file in any text editor to see the contents of the file which is just a json document with some key-value pairs.
After installing all the dependencies we should start a mongod to access the mongodb database. To start mongodb you open another command prompt and browse to the directory where you unzipped downloaded mongodb files. You should see a bin directory in the mongodb folder where all the executable files like mongo, mongod, mongoimport, mongoexport, mongodump are waiting for us to run them. Now browse to that directory with all the executables of mongodb in the command promt and enter the following command.
- mongod
It should start mongodb server but sometimes you may get an error that no db folder found, which means mongodb doesn't know where to store the data in your local drive. So you can mention the path to the directory where you want to store the mongodb data.
- mongod --dbpath [path to the directory]
The above command should start mongod server.
If everything is gone perfectly you can run the node js project using
- node index.js