You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
329 B
13 lines
329 B
// Single Page Apps - redirect to /#/
|
|
module.exports = function(req, res, next) {
|
|
if (req.method !== "GET" && req.method !== "HEAD")
|
|
next();
|
|
if (req.url !== '/') {
|
|
var route = req.url;
|
|
req.url = '/';
|
|
res.statusCode = 302;
|
|
res.setHeader('Location', req.url + '#' + route);
|
|
res.end();
|
|
}
|
|
else next();
|
|
}
|