About
Express 1) is a node http server (web server)
Articles Related
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!
- Go to the page http://localhost:300 and you see
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