23 lines
546 B
JavaScript
23 lines
546 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'}));
|
|
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) |