Node - Express (Web Framework)

About

Express is a Web Framework (web server) based on Node (ie javascript)

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

Reload

backend development server that will give you hot-redeploy

npm i nodemon -g

Documentation / Reference


Powered by ComboStrap