1 | // Single Page Apps - redirect to /#/
|
2 | module.exports = function(req, res, next) {
|
3 | if (req.method !== "GET" && req.method !== "HEAD")
|
4 | next();
|
5 | if (req.url !== '/') {
|
6 | var route = req.url;
|
7 | req.url = '/';
|
8 | res.statusCode = 302;
|
9 | res.setHeader('Location', req.url + '#' + route);
|
10 | res.end();
|
11 | }
|
12 | else next();
|
13 | }
|