Skip to content

Instantly share code, notes, and snippets.

@chrismatheson
Created November 5, 2013 10:49
Show Gist options
  • Save chrismatheson/7317223 to your computer and use it in GitHub Desktop.
Save chrismatheson/7317223 to your computer and use it in GitHub Desktop.
local server
grunt.registerTask('server', function () {
var express = require('express'),
proxy = require('simple-http-proxy'),
app = express();
app.use('/platform/', express.logger('tiny'));
app.use('/platform/v1/', proxy('https://siam.ivendi.com/platform/v1/'));
app.use('/src', express['static']('src'));
app.use('/vendor', express['static']('vendor'));
app.use('/static', express['static']('dist/static'));
app.use('/dist', express['static']('dist'));
app.all('/platform*', function (req, res) {
//got here means i cant find a static resource
res.sendfile('dist/index.html');
});
app.all('/', function (req, res) {
//got here means i cant find a static resource
res.redirect('/platform');
});
console.dir('listening :3000');
app.listen(3000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment