use proxy from query.proxy

This commit is contained in:
孟政元
2018-01-04 00:53:54 +08:00
parent f12c17ee93
commit a47a0e17ae
2 changed files with 15 additions and 1 deletions

8
app.js
View File

@ -23,6 +23,14 @@ app.use(cache("2 minutes", onlyStatus200));
app.use(express.static(path.resolve(__dirname, "public")));
app.use(function(req, res, next) {
const proxy = req.query.proxy;
if (proxy) {
req.headers.cookie = req.headers.cookie + `__proxy__${proxy}`;
}
next();
});
// 获取专辑内容
app.use("/album", require("./router/album"));