Skip to content

Instantly share code, notes, and snippets.

@ajerez
Last active March 26, 2019 14:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajerez/a365f89e1daac364462ae7aea0e10268 to your computer and use it in GitHub Desktop.
Save ajerez/a365f89e1daac364462ae7aea0e10268 to your computer and use it in GitHub Desktop.
server.js for Heroku deployment of a Vue Project with Node and Express.js
let history = require("connect-history-api-fallback");
let express = require("express");
let path = require("path");
let serveStatic = require("serve-static");
let compression = require("compression");
let app = express();
app.use(compression());
app.use(history());
app.use(serveStatic(__dirname + "/dist"));
let port = process.env.PORT || 5000;
app.listen(port);
console.log("Server started. Port: " + port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment