Skip to content

Instantly share code, notes, and snippets.

@artyomsveshnikov
Created August 22, 2021 10:32
Show Gist options
  • Select an option

  • Save artyomsveshnikov/ce435d6d419dccce4f3e6bcd4ffa3ef1 to your computer and use it in GitHub Desktop.

Select an option

Save artyomsveshnikov/ce435d6d419dccce4f3e6bcd4ffa3ef1 to your computer and use it in GitHub Desktop.
Simple server.js for Vue static site
//Install express server
const express = require('express');
const path = require('path');
const app = express();
// Serve only the static files form the dist directory
app.use(express.static(__dirname + '/dist'));
app.get('/*', function(req,res) {
res.sendFile(path.join(__dirname+'/dist/index.html'));
});
// Start the app by listening on the default Heroku port
app.listen(process.env.PORT || 8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment