4.2_express_basic_setup - MartijnKeesmaat/dating-app GitHub Wiki

Basic setup

npm init
npm install express —save

Setup

const express - require('express');
const port = 8000
const app = express();

Define static path

app.use('/static', express.static('static'));

Setup basic route

app.get('/', test);

function test(req, res) {
	res.send('<h1>Hello</h1>');
}

Serve on the port

app.listen(port);
⚠️ **GitHub.com Fallback** ⚠️