[www] + Config model; config updated; using remote config; server refactoring

This commit is contained in:
Roman Timashev committed 2017-09-19 13:45:06 +03:00
1 parent 18a0b36a09
commit 5ad321ec0e
7 files changed
+85 -69

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
/**
*
* @param redirectMap
* [{String url, String redirect}, ...]
* @returns {*}
*/
function redirect(redirectMap) {
return async (ctx, next) => {
const path = ctx.request.path
if (redirectMap.has(path)) {
const url = redirectMap.get(path)
ctx.redirect(url)
} else {
await next()
}
}
}
module.exports = redirect