[www] + Config model; config updated; using remote config; server refactoring
This commit is contained in:
1 parent
18a0b36a09
commit
5ad321ec0e
7 files changed
+85
-69
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user