2019-07-26 00:23:01 +02:00
|
|
|
import express, { static as _static } from 'express'
|
|
|
|
import { resolve } from 'path'
|
|
|
|
|
2019-08-03 23:55:22 +02:00
|
|
|
// create express app
|
2019-07-26 00:23:01 +02:00
|
|
|
const app = express()
|
|
|
|
|
2019-08-03 23:55:22 +02:00
|
|
|
// serve static assets
|
2019-07-26 00:23:01 +02:00
|
|
|
app.use(_static(__dirname))
|
|
|
|
|
2019-08-03 23:55:22 +02:00
|
|
|
// serve single page application
|
2019-07-28 11:16:49 +02:00
|
|
|
app.get('*', (rex, res) => {
|
2019-07-26 00:23:01 +02:00
|
|
|
res.sendFile(resolve(__dirname, 'index.html'))
|
|
|
|
})
|
|
|
|
|
2019-08-03 23:55:22 +02:00
|
|
|
// listen to the port from .env (default to 8080)
|
2019-07-26 00:23:01 +02:00
|
|
|
app.listen(process.env.PORT || 8080)
|