23 lines
475 B
JavaScript
23 lines
475 B
JavaScript
const express = require('express');
|
|
|
|
// instantiate new express.js app
|
|
const app = express();
|
|
const port = 3000;
|
|
|
|
// load the template engine
|
|
app.set('view engine', 'twig');
|
|
|
|
// enable static file serving
|
|
app.use(express.static('public'));
|
|
|
|
// load route handlers
|
|
const homeRoutes = require('./src/routes/home');
|
|
|
|
// register route handlers
|
|
app.get('/', homeRoutes.getIndex);
|
|
|
|
// start app
|
|
app.listen(port, () => {
|
|
console.log(`Example app listening on port ${port}`);
|
|
});
|