MCPcopy Create free account
hub / github.com/dailydotdev/apps / corsFor

Function corsFor

packages/world-cli/src/dev.js:48–57  ·  view source on GitHub ↗
(req)

Source from the content-addressed store, hash-verified

46};
47
48const corsFor = (req) => {
49 const origin = allowedOrigin(req.headers.origin);
50 return {
51 ...(origin ? { "access-control-allow-origin": origin } : null),
52 "access-control-allow-headers": "*",
53 "access-control-allow-methods": "GET, OPTIONS",
54 "access-control-allow-private-network": "true",
55 vary: "Origin",
56 };
57};
58
59const json = (req, res, status, body) => {
60 res.writeHead(status, {

Callers 3

jsonFunction · 0.85
compressedJsonFunction · 0.85
startDevFunction · 0.85

Calls 1

allowedOriginFunction · 0.85

Tested by

no test coverage detected