Skip to content

Instantly share code, notes, and snippets.

@lucasalmeida92
Created December 29, 2015 20:44
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucasalmeida92/7f67f5183318d44f348b to your computer and use it in GitHub Desktop.
Save lucasalmeida92/7f67f5183318d44f348b to your computer and use it in GitHub Desktop.
html5mode + ionic (express server for production)
// Set up =================================
var express = require('express');
var app = express();
// Constants =================================
var PORT = 8100;
// Config =================================
app.use(express.static(__dirname + '/www'));
// Routes =================================
app.all('*', function (req, res, next) {
// Just send the index.html for other files to support HTML5Mode
res.sendFile('www/index.html', { root: __dirname });
});
// Listen =================================
app.listen(PORT);
console.log('\n\n•••••••••••••••••••••••••••••••••••••\n Running on http://localhost:' + PORT + '\n••••••••••••••••••••••••••••••••••••••••••\n :) \n\n');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment