shin-neo-lyrical-tokarev/app.js
2024-10-14 21:21:19 -03:00

31 lines
760 B
JavaScript

const express = require('express')
const app = express()
const port = 3003
const serveIndex = require('./src/utils/serve_index')
const {engine} = require('express-handlebars')
const indexRouter = require('./src/router/indexRouter')
const publicPath = "/public"
const inUrlPath = "public"
const path = require('path');
const { template } = require('handlebars')
app.engine('.hbs', engine({extname: '.hbs', helpers: {
ifDivisibleBy: function (index, divisor, options) {
if (index % divisor === 0) {
return options.fn(this);
}
}
}}));
app.set('view engine', '.hbs');
app.use(publicPath, express.static(inUrlPath), serveIndex(inUrlPath, {
}))
app.listen(port, () => {
console.log(`Listening on port ${port}`)
})
app.use('/', indexRouter)