23 lines
479 B
JavaScript
23 lines
479 B
JavaScript
|
const express = require('express');
|
||
|
const Twig = require("twig");
|
||
|
|
||
|
const app = express();
|
||
|
const port = 3000;
|
||
|
|
||
|
// serve static files
|
||
|
app.use(express.static('public'));
|
||
|
|
||
|
// configure Twig templating
|
||
|
app.set("twig options", {
|
||
|
allowAsync: true, // Allow asynchronous compiling
|
||
|
strict_variables: false
|
||
|
});
|
||
|
|
||
|
// register routes
|
||
|
const routes = require('./src/routes');
|
||
|
routes.registerRoutes(app);
|
||
|
|
||
|
app.listen(port, () => {
|
||
|
console.log(`Example app listening on port ${port}`);
|
||
|
});
|