This repository has been archived on 2022-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
teemant-old/src/server/index.js

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}/`)
})