This commit is contained in:
MeowcaTheoRange 2024-06-11 01:06:26 -05:00
parent af37f779ef
commit 5bec55e0c2

View file

@ -1,5 +1,4 @@
import express from 'express';
import { createProxyMiddleware } from 'http-proxy-middleware';
import config from "../eventmapper_config.json" with { type: "json" };
@ -10,20 +9,13 @@ app.use("/assets", express.static('assets'));
app.use("/", express.static('pages'));
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);
let events = await eventsReq.arrayBuffer();
res.type(eventsReq.headers.get("Content-Type"));
return res.send(Buffer.from(events));
return res.status(eventsReq.status).send(Buffer.from(events));
})
app.get('/data/:lang/events/:floor', async (req, res) => {