Express je framework pro práci s Node.js.
Vytvoření kostry aplikace:
- npm init –yes
- npm install express
- vytvořit soubor index.js
index.js
const express = require('express');
const app = express();
app.listen(3000, () => console.log('Listening on port 3000...'));
app.get('/hello', (req, res) => {
res.send("Hello");
});
Spuštění
node index.js Listening on port 3000...
Výsledek bude na adrese http://localhost:3000/hello.