Skip to content

Instantly share code, notes, and snippets.

@yomete
Created April 27, 2019 09:42
Show Gist options
  • Save yomete/473ddc777e87180148677ad984bfe8b2 to your computer and use it in GitHub Desktop.
Save yomete/473ddc777e87180148677ad984bfe8b2 to your computer and use it in GitHub Desktop.
var express = require('express')
var path = require('path')
var serveStatic = require('serve-static')
// var helmet = require('helmet')
var app = express()
// Middleware
// app.use(helmet())
app.use("/", serveStatic(path.join(__dirname, '/dist')))
// Catch all routes and redirect to index
app.get('*', function (req, res) {
res.sendFile(__dirname + '/dist/index.html')
})
var port = process.env.PORT || 8000
app.listen(port)
console.log('server started ' + port)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment