|<- [[Using templates]]|[[Using locals and conditional templates]] ->| === Partials === == default.ejs == <% include partials/head.ejs %>

<%= title %>

<%= content %>

== /partials/head.ejs == <%= title %> == index.js == var express = require('express'); var app = express(); app.set('view engine', 'ejs'); app.get('/', function(req, res) { console.log('/ requested'); res.render('default', { title: 'Hello', content: 'Heyyy salut-donc !' }); }) // si on a autre chose app.get('*', function(req, res) { console.log('Page inconnue demandée'); res.render('default', { title: '😭', content: '😭😭😭'}); }) var server = app.listen(3000, function() { console.log('Listening on port 3000.'); })