Skip to content

Instantly share code, notes, and snippets.

@gnrlbzik
Created August 5, 2013 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnrlbzik/6157231 to your computer and use it in GitHub Desktop.
Save gnrlbzik/6157231 to your computer and use it in GitHub Desktop.
Wild card serving static website.
var express = require('express');
var http = require('http');
var path = require('path');
var app = express();
app.get("/css/*",function(req,res){
res.sendfile('app'+req.path);
});
app.get("/js/*",function(req,res){
res.sendfile('app'+req.path);
});
app.get("/img/*",function(req,res){
res.sendfile('app'+req.path);
});
app.get("/pages/*",function(req,res){
res.sendfile('app'+req.path);
});
app.get('*',function(req,res){
res.sendfile('app/index.html');
});
app.listen(3000);
console.log('Listening on port 3000');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment