shin-neo-lyrical-tokarev/app.js
2024-10-09 21:04:09 -03:00

29 lines
688 B
JavaScript

const express = require('express')
const app = express()
const port = 3003
const serveIndex = require('serve-index')
const {engine} = require('express-handlebars')
const indexRouter = require('./src/router/indexRouter')
const publicPath = "/public"
const inUrlPath = "public"
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, {
icons: true
}))
app.listen(port, () => {
console.log(`Listening on port ${port}`)
})
app.use('/', indexRouter)