Create your Node.js application

Previous step: Introduction and prerequisites

In this step, you create a simple Node.js app using the Express application generator that you can then deploy to Azure.

You can also use the app from the Visual Studio Code Node.js tutorial, in which case you can skip ahead to Deploy the app.

  1. In a terminal or command prompt, use the following command to run the Express Generator and scaffold a new Express app called "myExpressApp". (The --view pug --git parameters tell the generator to use the pug template engine, formerly known as Jade, and to create a .gitignore file.)

    npx express-generator myExpressApp --view pug -–git
    
  2. Install the application's dependencies by running npm install in the app folder:

    cd myExpressApp
    npm install
    
  3. Start the server by running npm start:

    npm start
    
  4. Test the app by opening a browser to http://localhost:3000. The site should appear as follows:

    Running Express Application