Quick Start
Add custom routes using theaddRoute method or by accessing the underlying Hono app:
Using Hono’s Native API
For advanced use cases, access the underlying Hono app directly:Path Parameters and Wildcards
Custom routes support path parameters and wildcard patterns:- Path Parameters
- Wildcards
- Query Parameters
Public Routes
By default, custom routes require authentication (if configured). Make routes public by adding the{ public: true } option:
Public routes are perfect for:
- OAuth discovery endpoints (
.well-known/*) - Health checks and status pages
- Static assets and documentation
- Webhook endpoints from external services
Real-World Examples
REST API
Admin Interface
Webhooks
File Upload
Integration with MCP Tools
Custom routes can interact with MCP tools and share data:Supported HTTP Methods
Custom routes support all standard HTTP methods:GET- Retrieve dataPOST- Create new resourcesPUT- Update existing resourcesDELETE- Delete resourcesPATCH- Partial updatesOPTIONS- CORS preflight requests
Request and Response Helpers
Request
Response
Complete Example
Here’s a complete example from the FastMCP repository showing custom routes with authentication, public endpoints, and MCP integration:src/examples/custom-routes.ts
Next Steps
Authentication
Learn how to protect custom routes with authentication
Edge Runtime
Deploy custom routes to Cloudflare Workers