MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / routeUrl

Function routeUrl

apps/yalt/src/index.ts:53–87  ·  view source on GitHub ↗
(url: URL, env: Env)

Source from the content-addressed store, hash-verified

51 | { type: 'not_found' };
52
53function routeUrl(url: URL, env: Env): RouteDecision {
54 const searchParams = new URLSearchParams(url.search);
55
56 if (searchParams.has('t')) {
57 const name = searchParams.get('t');
58
59 if (name) {
60 return { type: 'tunnel', name };
61 }
62
63 return { type: 'management' };
64 }
65
66 if (!url.host.includes(env.WORKER_HOST)) {
67 return { type: 'not_found' };
68 }
69
70 const parts = url.host.split('.');
71
72 if (parts.length === 2) {
73 return { type: 'management' };
74 }
75
76 const tunnelName = parts[0];
77
78 if (tunnelName === 'admin') {
79 return { type: 'management' };
80 }
81
82 if (parts.length === 3) {
83 return { type: 'tunnel', name: parts[0] };
84 }
85
86 return { type: 'not_found' };
87}
88
89async function handleManagementRequest(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
90 const authHeader = request.headers.get('authorization');

Callers 1

fetchFunction · 0.85

Calls 2

hasMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…