2022-10-13 14:59:02 +01:00
|
|
|
import express from 'express'
|
|
|
|
import * as eta from 'eta'
|
|
|
|
|
|
|
|
const app = express()
|
|
|
|
const port = 3000
|
|
|
|
const engine = 'eta'
|
|
|
|
|
|
|
|
app.engine(engine, eta.renderFile)
|
|
|
|
app.set('view engine', engine)
|
|
|
|
app.set('views', './src/views')
|
|
|
|
|
|
|
|
app.get('/', (req, res) => {
|
2022-10-13 20:37:37 +01:00
|
|
|
res.render('index', {
|
|
|
|
answer: 42
|
|
|
|
})
|
2022-10-13 14:59:02 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
app.listen(port, () => console.log(`App running on port ${port}, with view engine ${engine}`))
|