Created
August 5, 2013 16:19
-
-
Save gnrlbzik/6157231 to your computer and use it in GitHub Desktop.
Wild card serving static website.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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