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.
 
 
 
 
 
 

15 lines
283 B

export default function (req, res, next) {
const redirects = [
{
from: '/',
to: '/go'
}
]
const redirect = redirects.find(r => r.from === req.url)
if (redirect) {
res.writeHead(301, { Location: redirect.to })
res.end()
} else {
next()
}
}