Created
April 27, 2019 09:42
-
-
Save yomete/473ddc777e87180148677ad984bfe8b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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