mirror of
https://github.com/CompassConnections/Compass.git
synced 2025-12-23 22:18:43 -05:00
Add proxy
This commit is contained in:
14
web/pages/api/proxy-data.ts
Normal file
14
web/pages/api/proxy-data.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export default async function handler(req: any, res: any) {
|
||||
const { path } = req.query; // e.g. "v4FoTtuyX_XwjC3aS2_Y6/Martin.json"
|
||||
const upstreamUrl = `https://www.compassmeet.com/_next/data/${path}`;
|
||||
|
||||
const upstream = await fetch(upstreamUrl);
|
||||
const body = await upstream.text();
|
||||
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||
res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
|
||||
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
|
||||
|
||||
res.status(upstream.status).send(body);
|
||||
}
|
||||
Reference in New Issue
Block a user