Skip to content

Instantly share code, notes, and snippets.

@Momciloo
Last active October 17, 2017 12:35
Show Gist options
  • Save Momciloo/7bd38b3286d07b7080286b820da3631e to your computer and use it in GitHub Desktop.
Save Momciloo/7bd38b3286d07b7080286b820da3631e to your computer and use it in GitHub Desktop.
Serving VueJS in history mode
{
"name": "vueserver",
"version": "1.0.0",
"description": "A VueJS server",
"author": "Momcilo Popov",
"private": true,
"scripts": {
"start": "node server.js"
},
"dependencies": {
"connect": "^3.6.5",
"express": "^4.16.2",
"path": "^0.12.7",
"serve-static": "^1.13.1"
},
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
}
}
var express = require('express');
var server = express();
server.use('/static', express.static(__dirname + '/static'));
server.get('/*', function (req, res) {
res.sendFile(__dirname + '/index.html');
});
var port = 8000;
server.listen(port, function () {
console.log('server listening on port ' + port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment