function onrequest(req, res) {
const context = getContext(req);
fs.readFile(path.join(__dirname, 'index.html'), 'utf8', function onreadIndex(err, src) {
if (err) return console.error(err)
const html = header + templateEngine(src, context)
serve(html)
})
}
context
and src
of index.html
are created for each request