Hands-On Data Structures and Algorithms with JavaScript
上QQ阅读APP看书,第一时间看更新

Creating a Node.js application

To start off a sample Node.js project, simply create a project folder first and then run the following command from that folder:

npm init

On running this command, Node will prompt you with a series of questions, which you can either fill or leave blank:

Once the blank application is created, all you see is a file called package.jsonYou can now add the dependencies that are needed to create the Node.js application:

npm install body-parser express --save

The body-parser module helps with parsing of the POST request body, whereas the express module helps with the creation of the Node.js server.