For this chapter, we will use a very simple and light Node.js application, which will be holding our example scripts. The main goal here is to be able to run each of the use cases individually and not have an entire web (client or server) application for each of them. This helps us to have a uniform base project.
- The first step is to create your application's project folder. From the Terminal, run the following command:
mkdir <project-name>
- Then, to initialize a Node.js project, run the
init
command in theroot
folder of the project. This will prompt a series of questions to generate thepackage.json
file. You can fill out the answers you wish or just click on return to accept default values for the prompts:
cd <project-name> npm init
- Let's also install our beloved
lodash
to help us out with some of the trivial array and object manipulations and utilities:
npm install --save lodash