Step 1 (Install Node):
Download and Install NodeJS from this link
Step 2 (Install Mongo DB):
Download and Install Mongo DB from this link (make sure that you follow the instructions on the page to setup the Windows service and test it, before proceeding further).
Step 3 (Setup development environment):
- Fire up “Visual Studio Code” and use the “Open Folder” option to point to “any” folder where you plan to create/store the project specific files (to be created as part of the “hello world” application).
- Use the “File-> New File” option (or the “New File” in the Explorer window) to create a new file and name it as “main.js“.
- Launch the “Integrated Terminal” window from “View->Integrated Terminal”.
- Type “npm init” (as provided in the below image and keep pressing “enter” for all questions prompted to assign the default values, which can be overridden by providing a custom value, if preferred).
- When completed it will create the “package.json” file along with all the default settings.
- Open up the “package.json” and add the dependencies for mongodb and mongoose (as highlighted below) and save the file:
- In the “Integrated Terminal” type “npm install” and hit enter
- After the dependencies are installed by npm, you should see the “node_modules” folder on the explorer window (which contains all the dependent npm modules required for mongodb and mongoose to run in nodejs ecosystem):
2,431 total views, 2 views today