Using Gulp and Nodemon


npm init

then insert project info


npm install express

touch app.js

Let’s install it where it save info into the project json file:


npm install gulp –save
npm install gulp -g
npm install gulp-nodemon

for using nodemon to restart the server whenever you make a change:

npm install -g nodemon

Installing nodemon basically means you can start your server like so:
“nodemon app.js”,
and whenever you save a change, it will restart your server for you.

Go to your root directory, then create a file called gulpfile.js with the code like below:

touch gulpfile.js

shortcut for starting your server

Whenever you run the project, usually people would do “node app.js”. But it can get annoying. So instead, we can shortcut it with start. So next time, all you gotta do to start the server is to type: npm start.

Remeber to use nodemon app.js as the command. Or else, you won’t get the capabilities of nodemon.

So now, you can simply go npm start, and your server will start.