webiny-http-route
What it does
This skill guides your AI when exposing a plain web address on a Webiny API. It is for developers who need a simple HTTP endpoint for webhooks, integrations or custom responses.
When to use it
- ✓When you need a plain HTTP endpoint on the API, not a GraphQL query.
- ✓When another system must call a custom URL to send data to your project.
- ✓When a custom route needs access to platform services such as logging.
Skill link
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api/http-route/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Create a POST route on our Webiny API that receives webhook data from our payment provider and logs it.”
5 new skills a week. 1 minute to read.
How it works
The skill explains writing a handler class with a handle method and registering it with the route's method and path in the configuration file. The handler receives its services through the container.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Custom HTTP Routes
TL;DR
Write a handler that implements HttpRouteHandler.Interface, then point <Api.Route> at it in
webiny.config.tsx. The method and path props configure both the API Gateway route and the
router, so the handler file never restates them. Handlers get full DI.
YOU MUST include the full file path with the .ts extension in the src prop. Use
src={"/extensions/MyRoute.ts"}, not src={"/extensions/MyRoute"}. Omitting it fails the build.
YOU MUST use export default for the createImplementation() call. Named exports fail here.
The route pattern
// extensions/MyRoute.ts
import { HttpRouteHandler, Logger } from "webiny/api";
class MyRouteImpl implements HttpRouteHandler.Interface {
constructor(private logger: Logger.Interface) {}
async handle(request: HttpRouteHandler.Request, response: HttpRouteHandler.Response) {
this.logger.info({ path: request.path }, "Handling request");
return response.status(200).json({ status: "ok" });
}
}
export default HttpRouteHandler.createImplementation({
implementation: MyRouteImpl,
dependencies: [Logger]
});
Register it:
<Api.Route method={"POST"} path={"/my-route"} src={"/extensions/MyRoute.ts"} />
Props reference
| Prop | Type | Required | Description |
|---|---|---|---|
path |
string |
Yes | Route path — must start with / |
method |
string |
Yes | HTTP method (see below) |
src |
string |
Yes | Path to the handler file (must include .ts) |
routeName |
string |
No | Route name (kebab-case). Derived from path + method if omitted. Doubles as the Pulumi resource name and the id a decorator matches on |
Methods: DELETE, GET, HEAD, PATCH, POST, PUT, OPTIONS, ANY. Use ANY to match every
method on a path.
Path parameters
Write them either way. {orderId} is API Gateway syntax, :orderId is the router's; the extension
converts to whichever each consumer needs, so both work and mean the same thing.
<Api.Route method={"GET"} path={"/orders/{orderId}"} src={"/extensions/GetOrderRoute.ts"} />
<Api.Route method={"GET"} path={"/orders/:orderId"} src={"/extensions/GetOrderRoute.ts"} />
Read them off request.pathParameters:
class GetOrderRouteImpl implements HttpRouteHandler.Interface {
constructor(private getOrder: GetOrderUseCase.Interface) {}
async handle(request: HttpRouteHandler.Request, response: HttpRouteHandler.Response) {
const order = await this.getOrder.execute(request.pathParameters.orderId);
return response.status(200).json(order);
}
}
export default HttpRouteHandler.createImplementation({
implementation: GetOrderRouteImpl,
dependencies: [GetOrderUseCase]
});
Wildcards are the exception: /files/* matches for the router, {proxy+} for API Gateway, and they
capture differently. Write a wildcard route for the target you mean.
Request
HttpRouteHandler.Request is transport-agnostic — no API Gateway or Node types leak into your code.
interface Request {
method: string;
path: string;
headers: Record<string, string>;
query: Record<string, string>;
pathParameters: Record<string, string>;
body: any;
/** Which route matched — `{ name, method, path }`. */
route: MatchedRouteDefinition;
}
route is what makes a decorator able to act on one route (see below), and lets a handler read its
own identity. method/path on it are the route's PATTERN (/orders/:orderId), where the
top-level method/path are the request's actual values (/orders/abc123).
Response
HttpRouteHandler.Response is a mutable builder, the res of an Express-style handler. Every method
returns this, so calls chain:
| Method | Purpose |
|---|
FAQ
Where is the method and path set?
In the route registration in the configuration file, so the handler file does not repeat them.
Can the handler use a logger?
Yes. The skill's example injects a logger as a dependency.
Do I need a special file extension in the path?
Yes. The source path must include the .ts extension.
Details
Original description by the author
Adding custom HTTP routes to the API with <Api.Route> and HttpRouteHandler. Use this skill when the developer wants to expose a custom HTTP endpoint (GET, POST, PUT, etc.) on the API alongside the GraphQL handler, implement a route handler with full DI support, or register a custom HTTP route in webiny.config.tsx.
repo: webiny/webiny-js
Popularity
- GitHub stars
- 8.1k
- Ranking position
- #12588
- License
- —
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
prd-to-plan
8.1kHelps your agent turn a product requirements document into a phased plan of small end-to-end slices, saved as a Markdown file.
webiny-admin-architect
8.1kTeaches your agent how to build admin screens for the Webiny platform, using its business logic layers and presenter pattern.
webiny-admin-permissions
8.1kTeaches your agent to add permission controls to Webiny admin screens, including auto-generated permission forms and hide-or-show checks.
webiny-form-model
8.1kTeaches your agent to build forms in Webiny using a declarative field builder, layouts, validation and conditional rules.
Similar skills
api-connector-builder
280kHas your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
api-design
280kHelps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
backend-patterns
280kHelps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.