# OmniRoute HTTP Methods Support: Built-In GET, POST, PUT, and DELETE Handling

> OmniRoute offers built-in support for GET POST PUT DELETE HTTP methods using Nextjs 16 App Router conventions. Learn how to easily handle requests.

- Repository: [Diego Rodrigues de Sa e Souza/OmniRoute](https://github.com/diegosouzapw/OmniRoute)
- Tags: how-to-guide
- Published: 2026-08-17

---

**Yes, OmniRoute provides first-class, built-in support for standard HTTP methods—including GET, POST, PUT, and DELETE—through Next.js 16 App Router conventions, where each endpoint exports async functions named exactly after the HTTP verb they handle.**

OmniRoute (available at `diegosouzapw/OmniRoute`) is an AI gateway and management platform built on Next.js 16. By leveraging the App Router’s file-based API routes, the codebase handles HTTP methods natively without custom routing logic or external HTTP parsers. Every route file under `src/app/api/…` defines named exports that Next.js automatically maps to incoming requests based on their method headers.

## How OmniRoute Implements HTTP Methods

OmniRoute follows the **Next.js 16 App Router convention**, where HTTP method handlers are simply exported async functions. When a request arrives, Next.js inspects the method header and invokes the correspondingly named export—`GET`, `POST`, `PUT`, `DELETE`, or `PATCH`—passing the standard Web API `Request` object and a `params` promise for dynamic segments.

This design means **every HTTP verb is natively supported** as long as the named export exists. The handlers return standard `Response` objects (or [`NextResponse.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/NextResponse.json)), allowing seamless integration with the repository’s shared validation, authentication, and error-sanitization utilities.

### Supported Verbs

The base implementation covers the complete set of standard REST verbs:

- **GET** — Retrieves resources, applies pagination, and returns filtered catalogs.
- **POST** — Creates new entities or triggers async operations like model synchronization.
- **PUT** — Updates existing configuration, such as per-provider rate limits.
- **DELETE** — Permanently removes resources like registered API keys.
- **PATCH** — Occasionally implemented for partial updates where supported by the endpoint.

## Code Examples of HTTP Method Handlers

The repository contains dozens of concrete implementations demonstrating this pattern across management, tooling, and core API surfaces.

### Model Catalog Endpoints (GET and POST)

The file [`src/app/api/v1/models/route.ts`](https://github.com/diegosouzapw/OmniRoute/blob/main/src/app/api/v1/models/route.ts) exposes both read and write operations for the model catalog:

```typescript
// src/app/api/v1/models/route.ts
export async function GET(request: Request) {
  // Validate query, fetch model catalog, return JSON
  const catalog = await getModelCatalog();
  return NextResponse.json(catalog);
}

export async function POST(request: Request) {
  // Parse body, create a new model entry
  const payload = await request.json();
  await createModel(payload);
  return new Response(null, { status: 201 });
}

```

The `GET` handler validates query parameters and returns the catalog as JSON, while the `POST` handler parses the request body, persists a new model, and returns a `201 Created` response.

### Provider Limit Updates (PUT)

Dynamic routes with parameters implement updates using `PUT`. In `src/app/api/v1/providers/[provider]/limits/route.ts`, the handler receives the provider identifier via the `params` promise:

```typescript
// src/app/api/v1/providers/[provider]/limits/route.ts
export async function PUT(request: Request, { params }: { params: Promise<{ provider: string }> }) {
  const { provider } = await params;
  const limits = await request.json();
  await updateProviderLimits(provider, limits);
  return new Response(null, { status: 204 });
}

```

This pattern extracts the dynamic `[provider]` segment, validates the incoming limit configuration, and returns `204 No Content` on success.

### API Key Revocation (DELETE)

Resource deletion follows the same structure. The `DELETE` export in `src/app/api/v1/registered-keys/[id]/route.ts` handles permanent key revocation:

```typescript
// src/app/api/v1/registered-keys/[id]/route.ts
export async function DELETE(request: Request, { params }: { params: Promise<{ id: string }> }) {
  const { id } = await params;
  await revokeKey(id);
  return new Response(null, { status: 204 });
}

```

The function awaits the `id` parameter, executes the revocation logic, and responds with a `204` status to confirm the resource has been removed.

## Core Routing Files Supporting HTTP Methods

The following files illustrate the consistent application of HTTP method exports throughout the OmniRoute codebase:

- **[`src/app/api/v1/models/route.ts`](https://github.com/diegosouzapw/OmniRoute/blob/main/src/app/api/v1/models/route.ts)** — Implements **GET** for retrieving the paginated model catalog and **POST** for creating new model entries or triggering sync operations.
- **`src/app/api/v1/providers/[provider]/limits/route.ts`** — Implements **PUT** for updating per-provider rate limits and quota settings.
- **`src/app/api/v1/registered-keys/[id]/route.ts`** — Implements **DELETE** for permanently revoking registered API keys.
- **[`src/app/api/v1/management/proxies/route.ts`](https://github.com/diegosouzapw/OmniRoute/blob/main/src/app/api/v1/management/proxies/route.ts)** — Implements **GET**, **POST**, **PUT**, and **DELETE** for full proxy subscription lifecycle management.
- **`src/app/api/tools/traffic-inspector/sessions/[id]/route.ts`** — Implements all four primary verbs (**GET**, **POST**, **PUT**, **DELETE**) for managing traffic-inspector sessions.
- **`src/app/api/v1/[...omnirouteCatchAll]/route.ts`** — Provides a fallback catch-all handler that supplies generic processing for any HTTP verb not explicitly defined in specific route files.

Each file follows the exact same pattern: export an async function named for the verb, extract parameters via the `params` promise, execute business logic utilizing shared services, and return an appropriate HTTP response.

## Summary

- OmniRoute uses **Next.js 16 App Router conventions** to provide built-in HTTP methods support without custom routing code.
- Route files in `src/app/api/` export **named async functions** (`GET`, `POST`, `PUT`, `DELETE`) that Next.js automatically invokes based on the request method.
- Dynamic segments (e.g., `[id]`, `[provider]`) are accessed via the `params` promise passed as the second argument to handlers.
- The repository implements the full complement of REST verbs across management, tooling, and core API endpoints, with a catch-all route providing fallback handling.

## Frequently Asked Questions

### Does OmniRoute support PATCH requests?

Yes, in addition to GET, POST, PUT, and DELETE, OmniRoute supports PATCH for partial updates where appropriate. The Next.js 16 foundation allows any standard HTTP verb to be implemented by exporting a function with the matching name, and PATCH handlers appear in specific endpoints requiring partial modification capabilities.

### How does OmniRoute handle requests to routes without a specific method handler?

According to the source code in `src/app/api/v1/[...omnirouteCatchAll]/route.ts`, OmniRoute includes a fallback catch-all route that provides generic handling for any verb. If a specific method export is absent from a target route file, Next.js’s built-in behavior combined with this catch-all ensures the request receives a consistent response rather than failing silently.

### Can OmniRoute handlers access dynamic URL parameters?

Yes. As demonstrated in `src/app/api/v1/registered-keys/[id]/route.ts` and `src/app/api/v1/providers/[provider]/limits/route.ts`, handlers receive a `params` promise as their second argument. By awaiting `params`, the function can destructure values from dynamic route segments such as `[id]` or `[provider]`, enabling resource-specific operations.

### Are OmniRoute's HTTP method handlers compatible with middleware?

Absolutely. Because OmniRoute uses native Next.js App Router patterns, the exported GET, POST, PUT, and DELETE functions integrate seamlessly with the middleware chain defined in the project root. Authentication checks, Zod validation, and logging layers defined in [`middleware.ts`](https://github.com/diegosouzapw/OmniRoute/blob/main/middleware.ts) or imported utilities apply uniformly to all HTTP method handlers across the API surface.