erratic-gate/src/server.ts
2019-08-04 00:55:22 +03:00

17 lines
386 B
TypeScript

import express, { static as _static } from 'express'
import { resolve } from 'path'
// create express app
const app = express()
// serve static assets
app.use(_static(__dirname))
// serve single page application
app.get('*', (rex, res) => {
res.sendFile(resolve(__dirname, 'index.html'))
})
// listen to the port from .env (default to 8080)
app.listen(process.env.PORT || 8080)