Как мы можем помочь?
< Все темы
Печать

Express.js + twig

npm install twig


const path = require('path');
const Twig = require('twig');
const express = require('express');

const app = express();

app.use(express.static(path.join(__dirname, 'public')));
app.set("twig options", {
    allowAsync: true,
    strict_variables: false
});

app.get('/', (req, res) => {
    res.render('index.twig');
});

const PORT = 3000;
app.listen(PORT, () => {
    console.log(`Application listening on port ${PORT}!`);
});
Оглавление