2012-10-02 01:35:43 +02:00
|
|
|
var path = require("path");
|
2012-10-27 18:05:26 +02:00
|
|
|
var fs = require("fs");
|
2012-10-02 01:35:43 +02:00
|
|
|
|
|
|
|
exports.expressCreateServer = function (hook_name, args, cb) {
|
2012-10-27 18:05:26 +02:00
|
|
|
args.app.get('/tests/frontend/specs_list.js', function(req, res){
|
|
|
|
fs.readdir('tests/frontend/specs', function(err, files){
|
|
|
|
if(err){ return res.send(500); }
|
|
|
|
|
|
|
|
res.send("var specs_list = " + JSON.stringify(files.sort()) + ";\n");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2012-10-02 01:35:43 +02:00
|
|
|
args.app.get('/tests/frontend/*', function (req, res) {
|
|
|
|
var subPath = req.url.substr("/tests/frontend".length);
|
|
|
|
if (subPath == ""){
|
|
|
|
subPath = "index.html"
|
|
|
|
}
|
2012-10-08 00:34:29 +02:00
|
|
|
subPath = subPath.split("?")[0];
|
2012-10-02 01:35:43 +02:00
|
|
|
|
|
|
|
var filePath = path.normalize(__dirname + "/../../../../tests/frontend/")
|
|
|
|
filePath += subPath.replace("..", "");
|
|
|
|
|
|
|
|
res.sendfile(filePath);
|
|
|
|
});
|
2012-10-27 17:41:17 +02:00
|
|
|
|
|
|
|
args.app.get('/tests/frontend', function (req, res) {
|
|
|
|
res.redirect('/tests/frontend/');
|
2012-10-27 18:05:26 +02:00
|
|
|
});
|
2012-10-02 01:35:43 +02:00
|
|
|
}
|