Commit 48c61881 authored by A. Koch's avatar A. Koch

added proxy

parent fce97c7d
......@@ -57,6 +57,12 @@ const setup = async function () {
app.use(cors, jwtCheck, json(), morgan(process.env.NODE_ENV === 'production' ? 'common' : 'dev'))
/**
* Add proxy
*/
const proxy = require('./middleware/proxy')
proxy(app)
/**
* Set up ACL
*/
......
const
axios = require('axios'),
send = require('@polka/send-type')
module.exports = function (app) {
app.use('/proxy', async (req, res, next) => {
const result = await axios.get(req.query.url)
send(res, 200, result.data, { 'Content-Type': result.headers['content-type'] })
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment