var express = require('express');
var send = require('send');
var _ = require('underscore');
var path = require("path");
module.exports = app = express();
// hack!! 响应任何层级请求类型,send模块智能判断content-type
app.get('/:path/[^\s]*', function(req, res, next) {
var resource = '/' + _.drop(_.compact(req.path.split('/')), 1).join('/');
console.log(resource);
send(req, resource, {root: path.resolve(__dirname, req.params.path)}).pipe(res);
});
app.listen(process.env.PORT || 3000);
console.log("Test Listen on port 3000");