Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
fix: re-add express server (#739)
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsANameToo authored Sep 18, 2019
1 parent 5272223 commit baf6db0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions express-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const express = require('express')
const fs = require('fs')
const path = require('path')
const history = require('connect-history-api-fallback')
const app = express()
const ip = process.env.EXPLORER_HOST || '127.0.0.1'
const port = process.env.EXPLORER_PORT || 4200

// Web Server
const distPath = path.join(__dirname + '/dist/')
if (fs.existsSync(distPath)) {
const staticFileMiddleware = express.static(distPath)
app.use(staticFileMiddleware)
app.use(history())
app.use(staticFileMiddleware)
app.get('/', function (req, res) {
res.render(path.join(distPath + '/index.html'))
})
const server = app.listen(port, ip)
} else {
throw new Error('No Dist Path - please build')
}

0 comments on commit baf6db0

Please sign in to comment.