Skip to main content
The Netlify adapter provides utilities for running Hono applications on Netlify Functions and Netlify Edge Functions.

Import

Functions

handle()

Converts a Hono application into a Netlify function handler.

Parameters

  • app - The Hono application instance

Returns

A request handler function that receives both the request and Netlify context.

Example

getConnInfo()

Extracts connection information from the Netlify context.

Returns

Example

Accessing Netlify Context

The Netlify context is available through c.env.context and provides access to geolocation data and other Netlify-specific features.

Context Interface

Example with Geolocation

Platform-Specific Notes

Netlify Functions vs Edge Functions

Netlify supports two types of functions:
  • Netlify Functions: Traditional serverless functions running on AWS Lambda
  • Netlify Edge Functions: Run on Deno at the edge, closer to users
The adapter works with both types.

Netlify Functions

Create functions in the netlify/functions/ directory:

Netlify Edge Functions

Create edge functions in the netlify/edge-functions/ directory:

File-Based Routing

Environment Variables

Access Netlify environment variables:

Request Context

The Netlify context provides additional functionality:

Configuration

netlify.toml

Function Configuration

For Netlify Functions, you can add configuration:

Deployment

Using Netlify CLI

Using Git Integration

  1. Connect your repository at app.netlify.com
  2. Configure build settings
  3. Deploy automatically on every push

Build Settings

  • Build command: npm run build
  • Publish directory: dist
  • Functions directory: netlify/functions

Complete Example

See Also