just use fetch and a buffer
This commit is contained in:
parent
c98063dbd4
commit
af37f779ef
1 changed files with 16 additions and 3 deletions
|
@ -9,9 +9,22 @@ app.use("/assets", express.static('assets'));
|
|||
|
||||
app.use("/", express.static('pages'));
|
||||
|
||||
app.use("/files", createProxyMiddleware({
|
||||
target: config.files_url
|
||||
}));
|
||||
app.get('/files/*', async (req, res) => {
|
||||
console.log(req.params);
|
||||
// Get events
|
||||
let eventsReq = await fetch(new URL(req.params[0], config.files_url));
|
||||
let events;
|
||||
if (eventsReq.ok)
|
||||
events = await eventsReq.arrayBuffer();
|
||||
else
|
||||
return res.status(eventsReq.status).send(await eventsReq.text());
|
||||
|
||||
console.log(events);
|
||||
|
||||
res.type(eventsReq.headers.get("Content-Type"));
|
||||
|
||||
return res.send(Buffer.from(events));
|
||||
})
|
||||
|
||||
app.get('/data/:lang/events/:floor', async (req, res) => {
|
||||
// Get events
|
||||
|
|
Loading…
Reference in a new issue