Table of Contents

About

Express 1) is a node http server (web server)

Sample app

  • Install express
npm install express 
  • Javascript
const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => res.send('Hello World!'))

app.listen(port, () => console.log(`Example app listening on port ${port}!`))
  • Start the server
node app.js
Example app listening on port 3000!

Hello World

Generator

http://expressjs.com/en/starter/generator.html

The app structure created by the generator is just one of many ways to structure Express apps

.
├── app.js
├── bin
│   └── www
├── package.json
├── public
│   ├── images
│   ├── javascripts
│   └── stylesheets
│       └── style.css
├── routes
│   ├── index.js
│   └── users.js
└── views
    ├── error.pug
    ├── index.pug
    └── layout.pug

Routing

http://expressjs.com/en/starter/basic-routing.html

Reload

backend development server that will give you hot-redeploy

npm i nodemon -g

Documentation / Reference