21 lines
555 B
JavaScript
21 lines
555 B
JavaScript
'use strict'
|
|
import express from 'express'
|
|
import path from 'path'
|
|
|
|
import config from '../globals'
|
|
import logger from './logger'
|
|
|
|
const app = express()
|
|
const router = express.Router()
|
|
const pubdir = path.join(__dirname, 'public')
|
|
const port = config.server.port || 8080
|
|
const cacheAge = 365 * 24 * 60 * 60 * 1000
|
|
|
|
app.use('/', express.static(pubdir, { maxAge: cacheAge }))
|
|
app.use('/:server', express.static(pubdir, { maxAge: cacheAge }))
|
|
|
|
app.use('/', router)
|
|
app.listen(port, function () {
|
|
logger.log(`*** Listening on http://localhost:${port}/`)
|
|
})
|