in testapp/scripts/web-server.js [35:76]
var testMiddleware = function(req, res, next) {
if (/ng[1-2]\/fastcall/.test(req.path)) {
res.status(200).send('done');
} else if (/ng[1-2]\/slowcall/.test(req.path)) {
setTimeout(function() {
res.status(200).send('finally done');
}, 5000);
} else if (/ng[1-2]\/fastTemplateUrl/.test(req.path)) {
res.status(200).send('fast template contents');
} else if (/ng[1-2]\/slowTemplateUrl/.test(req.path)) {
setTimeout(function() {
res.status(200).send('slow template contents');
}, 5000);
} else if (/ng[1-2]\/chat/.test(req.path)) {
if (req.method === 'GET') {
var value;
if (req.query.q) {
value = storage[req.query.q];
res.status(200).send(value);
} else {
res.status(400).send('must specify query');
}
} else if (req.method === 'POST') {
if (req.body.key == 'newChatMessage') {
if (!storage['chatMessages']) {
storage['chatMessages'] = [];
}
storage['chatMessages'].push(req.body.value);
res.sendStatus(200);
} else if (req.body.key == 'clearChatMessages') {
storage['chatMessages'] = [];
res.sendStatus(200);
} else {
res.status(400).send('Unknown command');
}
} else {
res.status(400).send('only accepts GET/POST');
}
} else {
return next();
}
};