Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link

Copilot AI commented Jul 2, 2025

Adds comprehensive support for React Native Expo API Routes, enabling developers to use Hono with Expo Router's file-based API routing system.

What's Added

📦 New Expo Adapter (src/adapter/expo/)

  • handle(app) - Returns object with all HTTP method handlers (GET, POST, etc.) that Expo Router expects
  • createMethodHandlers(app) - Granular control for selective method export
  • handleExpoRequest(app) - Simple single handler function for basic use cases

🚀 Usage Example

// app/api/hello+api.ts
import { Hono } from 'hono'
import { handle } from 'hono/expo'

const app = new Hono()

app.get('/', (c) => {
  return c.json({ message: 'Hello from Hono + Expo!' })
})

app.post('/', async (c) => {
  const body = await c.req.json()
  return c.json({ received: body })
})

// Export the HTTP method handlers that Expo expects
export const { GET, POST } = handle(app)

✨ Key Features

  • ✅ All HTTP methods supported (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS)
  • ✅ Full Hono middleware compatibility
  • ✅ Type-safe with TypeScript
  • ✅ Works with all Hono features (routing, validation, etc.)
  • ✅ Compatible with Expo Router file-based routing

🧪 Testing & Quality

  • 15 comprehensive tests (13 unit + 2 integration tests)
  • 100% test coverage for adapter code
  • TypeScript compilation verified
  • Linting passes
  • Integration tests demonstrate real-world usage patterns

📖 Documentation

  • Complete README with usage examples
  • JSDoc documentation for all functions
  • Multiple usage patterns covered

📦 Package Configuration

  • Added ./expo export to package.json
  • Proper TypeScript definitions included
  • Import available as hono/expo

This implementation follows the same patterns as existing adapters (like Vercel) and enables seamless code sharing between Expo projects and APIs while leveraging Hono's powerful feature set.

Fixes #1.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Support for React Native Expo API Routes Add React Native Expo API Routes adapter Jul 2, 2025
Copilot AI requested a review from glncy July 2, 2025 17:28
Copilot finished work on behalf of glncy July 2, 2025 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for React Native Expo API Routes

2 participants