First, configure the development environment:
1. Install node first
(1), Access http://nodejs.org Open the installation package, normal installation, click Next.
To test whether the installation was successful, open a command prompt, enter node, and enter node. JS Interactive mode.
Installing node. js in this way also automatically comes with NPM
(2), install node. js Package Manager (Express)
Open a new command-line window
Enter NPM Install-g Express on the command line
Express directory Structure t-1
Catalog/File |
Description |
./ |
root directory, our node. js code will be this directory |
Package.json |
NPM relies on configuration files, like Gemfile in Ruby, pom.xml files in Java maven. One will need to add Markdown-js project dependencies here |
App.js |
Entry file for the project |
public/ javascript/ stylesheets/ images/ |
Static resource files, Jquery/prettify.js and other static libraries will be here, of course, the front-end code of their own can also be put here |
views/ |
Template files, express default with Jade, of course, you can also use your favorite Haml,jes, Coffeekup, jquerytemplate and other template engine |
node_modules/ |
Store NPM installed to a local dependency package, the dependency package is declared in the Package.json file, and installed with the NPM Install command |
2. Installing MongoDB:
(1), visit http:www.mongodb.org, download the installation package;
(2), in the D Disk new MongoDB folder (this folder for the custom database installation directory D:\MongoDB) The compressed package just downloaded and copy the Bin folder to the MongoDB folder;
(3), create a new logs folder within the MongoDB folder (for storing log files D:\MongoDB\logs), and create a new empty file Mongodb.log within this folder.
(4), create a new data folder within the MongoDB folder (for storing database files D:\MongoDB\data);
(5), start MongoDB:
Run cmd as system Administrator and switch to D:\MongoDB\bin directory input Mongod.exe--dbpath=d:\mongodb\data. If you see the last line of the console similar to Tue Oct 11:50:55 [websvr] Admin Web console watiing for connections on port 28017 instructions to start successfully (MongoDB occupies system 28017 port) 。
6. Test MongoDB:
Create a new CMD window as an administrator, enter the bin directory of MongoDB into MONGO, as shown in the connecting to:test instructions to pass the test.
When you set up node project, you will find the following error:
The test should be followed:
(1), input MONGO, such as:
Appear:
In general this is the case: you specify the database, so you cannot. The service is loaded automatically. The second time, you can't connect.
Before each boot, you manually, specify the next self, specified, database
Input: Mongod--dbpath d:/mongodb/data (d:/mongodb/data the database path defined for itself)
The shell then displays the connection success:
(2), open a new shell, in the Shell find MONGO Current installation path, enter MONGO, test database connection:
(3), registered MongoDB for the system services, that is, each time you turn on the computer to start MongoDB, enter the following command: (if you need to uninstall the service, use "sc delete MongoDB")
Note: Here to use the Administrator (C:\Windows\System32) in order to set (the following code does not wrap)
C:\windows\system32>mongod--logpath d:/mongodb/logs/mongodb.log--logappend--dbpath D:/mongodb/data-- Directoryperdb--servicename MongoDB--install
(4), start MongoDB Service as Administrator: Input: net start MongoDB
Then run MongoDB in the project and there will be no connection errors ...
Install the above steps from:
To:
In the computer process, you can see:
(5), when we shut down all the shell, run the project again, found that the MongoDB is not connected again, you have to restart the MongoDB service as an administrator, enter the administrator rights (shell mail, log on as an administrator), and then enter: net stop MongoDB, Then go to the D:\mongodb\data path to delete the Mongod.lock file, open the shell again, log in as Administrator, enter:net start MongoDB, do not have to start the MongoDB service manually each time.
3, Installation Webstrom
Visit http://www.jetbrains.com/webstorm/download/
Download Webstorm installation package
Click the normal installation, and then search the online registration code.
If you don't like the theme of Webstorm, you can select File→settings→appearance→theme and choose the theme you like.
If you don't like the Webstorm font, you can select File→settings→editor→colors & Fonts and choose your favorite theme name:
Open Colors & Fonts, select Font, click the Save As button, and in the pop-up box, enter the file name of the font you saved: Click OK
Set the font size and move the fonts from the left box to the right through the small triangles, and move up to the top as your default font:
Click the Apply button, then click OK
4. Configure Node.js+webstorm Environment
Open Webstorm, select the JS button,
A popup box will pop up:
Here, if your core modules is not installed, click on the blue link on the right to install it.
Next, you can create a node. JS Project,
Click File, select New project, and fill in the box with the project's basic information:
Note that the location of the path selection, you need to click on the right button to browse the settings, the input does not count, choose a good project path, in the project name
Click OK, wait for the project to create.
node. js + webstorm Development Personal Blog: Configuring the development environment