Create and run a local Node.js app
In this step, you create a simple Node.js app using the Express application generator. You then run the app locally.
In a terminal or command prompt, navigate to a location where you want to create the app folder.
Run the following command to create a new Express app named expressApp1 using the Express Generator. (The
--view pug --gitparameters tell the generator to use the pug template engine, formerly known as Jade, and to create a .gitignore file.)
npx express-generator expressApp1 --view pug -–git
Navigate into the app folder:
Install the application's dependencies:
Start the server:
Test the app by opening a browser to http://localhost:3000. The site should appear as follows:
Press Ctrl+C in the terminal to stop the server.