endpoint-routing

endpoint-routing is a cursor rule for Cursor from brendadeeznuts1111/betting-brain-v3. It costs 3,581 tokens per session, scanned A, original, MIT.

Rules for writing HTTP endpoint handlers, which are the code that receives web requests and sends responses. They include searchable examples for response creation, request IDs, and logging.

In plain words
What is it for?
Use them when locating API handlers or following conventions for JSON responses, errors, request tracking, logging, and feature-flag checks.
Why use it?
They give developers and agents consistent patterns for finding and implementing request-handling code.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { generateRequestId, createOPTIONSResponse, createJSONResponse } from '../utils/request';.

Good fit Use them when locating API handlers or following conventions for JSON responses, errors, request tracking, logging, and feature-flag checks.

Compare 6 cursor rules from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/brendadeeznuts1111/betting-brain-v3
agentmods
npx agentmods add rules/brendadeeznuts1111/betting-brain-v3/endpoint-routing

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for endpoint-routing

README.md
[![agentmods](https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/endpoint-routing/github.svg)](https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/endpoint-routing)
Your own site
<a href="https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/endpoint-routing"><img src="https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/endpoint-routing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for endpoint-routing

Your own site · 80×15
<a href="https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/endpoint-routing"><img src="https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/endpoint-routing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 3,581 This file is loaded in full into every session.
When invoked 3,581 The same file — it is already loaded in full.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.03581 $0.03581
Opus 5 $0.01791 $0.01791
Sonnet 5 $0.00716 $0.00716
Haiku 4.5 $0.00358 $0.00358

Measured 11d ago against content hash aea7f5fc9317, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

endpoint-routing scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl http://localhost:8787/health
.cursor/rules/endpoint-routing.mdc · 596 lines

How it starts

The opening of the file, as written. The whole thing — 596 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Endpoint Routing Rules

🔍 Code Searchability Patterns

Find api-patterns Issues with ast-grep

# Find async function $NAME(request: Request, env: Env, requestId: string)
# Find return createJSONResponse($$$)
# Find return createErrorResponse($$$)
# Find generateRequestId()
# Find createLogger($$$)
ast-grep --pattern 'async function $NAME(request: Request, env: Env, requestId: string)' src/
ast-grep --pattern 'return createJSONResponse($$$)' src/
ast-grep --pattern 'return createErrorResponse($$$)' src/
ast-grep --pattern 'generateRequestId()' src/
ast-grep --pattern 'createLogger($$$)' src/
sg -p 'async' src/
sg -p 'return' src/
sg -p 'return' src/
sg -p 'generateRequestId()' src/
sg -p 'createLogger($$$)' src/

api-patterns Discovery Commands

sg search "async function" src/api/
sg search "createJSONResponse" src/
sg search "generateRequestId" src/
sg search "createLogger" src/

Search Examples

# Find all API endpoint handlers
sg search 'async' src/
# Find JSON response patterns
sg search 'return' src/
# Find request ID generation
sg search 'return' src/
# Find logging patterns
sg search 'generateRequestId()' src/

Main Entry Point

All HTTP requests are handled in src/index.ts via the fetch() handler.

Request Flow Pattern

import { generateRequestId, createOPTIONSResponse, createJSONResponse } from '../utils/request';
import { createLogger } from '../utils/logger';

1. Generate requestId: generateRequestId()
2. Parse URL: new URL(request.url)
3. Log request details with StructuredLogger
4. Handle CORS preflight: createOPTIONSResponse()
5. Route by pathname
6. Return response: createJSONResponse() (includes CORS)

Endpoint Categories

Core System Endpoints (4)

Pattern: Exact pathname match

if (url.pathname === '/health') {
  // Health check - used by all dashboards
  // Returns: { status, version, timestamp, requestId, duration }
}

if (url.pathname === '/logs') {
  // Centralized logging - used by browser extension
  // POST: Receives log batches from extension
}

if (url.pathname === '/diagnostics') {
  // System diagnostics - used by setup wizard, health monitor
  // Returns: bindings status, KV status, last checks
}

if (url.pathname === '/system-status') {
  // Detailed status - used by dashboard stats
  // Returns: uptime, memory, KV records, health indicators
}

Read the full file on GitHub · 596 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 596 lines · 3,581 tokens per session scan A aea7f5fc9317

Subscribe to this mod's changes

endpoint-routing is a cursor rule published in the GitHub repository brendadeeznuts1111/betting-brain-v3 (8 stars, last pushed 11mo ago), licensed MIT. It adds 3,581 tokens to every session, about $0.0179 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other cursor rules, from other repositories

workers-patterns

Skim this on every task that touches workers, env, routes, or bindings.

firtoz/cf-multiworker-starter-kit · 1,378 tokens

realtime-websockets

Socka-first Durable Object WebSockets, SSR-safe client URLs, no fake localhost. Use for durable-objects/, apps/web, WebSocket forwarding, or @firtoz/socka.

firtoz/cf-multiworker-starter-kit · 40 tokens

cloudflare-workers

A deployment and configuration guide for Cloudflare Workers, a platform for running server-side code at Cloudflare's edge. It covers NuxtHub, database choices, Wrangler settings, and two deployment paths.

YuDefine/nuxt-supabase-starter · 0 tokens

manual-review.backend

The obligations, predicates, evidence schema, failure handling, and review timing in this source are shared. Concrete browser, dispatch, question, filesystem, and command mechanics are target-native and MUST come from the selected runtime fragment at the matching adapter path. A fragment declares only the capability…

YuDefine/nuxt-supabase-starter · 0 tokens

api-patterns

MUST define request/response contracts in shared/schemas/ and derive exported types from the same module MUST use Zod validation for all API inputs — getValidatedQuery(event, schema.parse) / readValidatedBody(event, schema.parse) MUST call requireAuth() or requireRole() before any business logic MUST use…

YuDefine/nuxt-supabase-starter · 0 tokens

nuxt-security

A shared security baseline for Nuxt applications that use the nuxt-security module. It standardizes browser security headers, content rules, and related settings while allowing documented app-specific exceptions.

YuDefine/nuxt-supabase-starter · 0 tokens