Express.JS quick-start guide on Windows

 

Express.JS is a fairly new but increasingly popular Node framework for building web application. Being a Node based application means you spin up a web application in just few steps. In this guide, I’m going to show a quick-start on just how to do this on Windows.

  1. Install node.js. See this tutorial if you don’t already have node.js on your Windows.
  2. Create a directory for your new Express.JS app, run Command Prompt and cd into the directory. e.g. c:\users\<user name>\projects\fooApp
  3. Install express.js via npm ‘Node Package Manager’ that comes together with node.
  4. Once installation completed, you will be presented with a summary of what packages has been downloaded and it’s respective version.
    image
  5. Verify the Express.JS is installed and check it’s version with the command:

    express –-version

    Express will response with it’s version number.
    image
  6. Before continue with creating an Express app, have a look at what options is available for creating an Express app.

    express –-help

    image
  7. Go ahead and create an express app. Execute:

    express fooApp

    For the sake of simplicity, I’m not going to specify any options.
    image
  8. Before proceed with the instructions, lets have a look at the content of fooApp/package.json

    cd fooApp
    more package.json

    image
  9. Next we will install the related dependencies:
    npm install
    image
  10. Before proceed to run fooApp, take a quick look at these 3 files:
  11. Proceed to run fooApp, in the Command Prompt, execute:

    node app.js

    image
  12. Browse to http://localhost:3000
    image

Labels: ,