var express = require('express'); var app = express(); app.get('/', function(req, res) { res.send('<h1>😝</h1><p>Hello !</p>') }) app.get('/fr', function(req, res) { res.send('<h1>😝</h1><p>Bonjour !</p>') }) app.get('/who/:name?', function(req, res) { var name = req.params.name; res.send('<h1>😝</h1><p>Hello ' + name + ' !</p>') }) app.get('/who/:name?/:title', function(req, res) { var name = req.params.name; var title = req.params.title; res.send('<h1>😝</h1><p>Hello ' + name + ' !</p><p>' + title + '</p>') }) // si on a autre chose app.get('*', function(req, res) { var name = req.params.name; var title = req.params.title; res.send('<h1 style="font-size:250pt">😭</h1>'); }) var server = app.listen(3000, function() { console.log('Listening on port 3000.'); })