shin-neo-lyrical-tokarev/app.js

31 lines
760 B
JavaScript
Raw Normal View History

2024-10-05 20:50:29 -04:00
const express = require('express')
const app = express()
const port = 3003
2024-10-14 20:21:19 -04:00
const serveIndex = require('./src/utils/serve_index')
2024-10-09 02:12:54 -04:00
const {engine} = require('express-handlebars')
const indexRouter = require('./src/router/indexRouter')
2024-10-06 00:48:04 -04:00
const publicPath = "/public"
const inUrlPath = "public"
2024-10-05 20:50:29 -04:00
2024-10-14 03:05:08 -04:00
const path = require('path');
2024-10-14 20:21:19 -04:00
const { template } = require('handlebars')
2024-10-05 20:50:29 -04:00
2024-10-09 20:04:09 -04:00
app.engine('.hbs', engine({extname: '.hbs', helpers: {
ifDivisibleBy: function (index, divisor, options) {
if (index % divisor === 0) {
return options.fn(this);
}
}
}}));
2024-10-09 02:12:54 -04:00
app.set('view engine', '.hbs');
2024-10-06 00:48:04 -04:00
app.use(publicPath, express.static(inUrlPath), serveIndex(inUrlPath, {
}))
2024-10-05 20:50:29 -04:00
2024-10-14 20:21:19 -04:00
2024-10-05 20:50:29 -04:00
app.listen(port, () => {
console.log(`Listening on port ${port}`)
})
2024-10-09 02:12:54 -04:00
app.use('/', indexRouter)