expo-api-routes

Create Expo Router API routes for server-side logic deployed to EAS Hosting.

1|Updated Jul 4, 2026
One-click install
npx skills add https://github.com/trungenglish/SHOPWISE --skill expo-api-routes-trungenglish
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: expo-api-routes
Source: https://github.com/trungenglish/SHOPWISE/tree/main/.agents/skills/expo-api-routes
Command: npx skills add https://github.com/trungenglish/SHOPWISE --skill expo-api-routes-trungenglish

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Mobile and web apps often need server-side logic—hiding API keys, validating input, proxying third-party services, or receiving webhooks—without standing up a separate backend. This Skill guides the creation of Expo Router API routes that run on EAS Hosting (Cloudflare Workers), keeping secrets and sensitive operations off the client. ## Core Features & Use Cases - Route Authoring Patterns: Covers +api.ts file conventions, HTTP method exports (GET, POST, PUT, DELETE), dynamic routes like users/[id]+api.ts, query parameters, headers, and JSON body handling. - Security & Secrets Management: Shows how to use process.env for server-side keys, add CORS headers, build authentication middleware, and proxy external APIs like OpenAI without exposing credentials. - EAS Hosting Deployment: Explains eas deploy, environment variable management with eas env:create, and Cloudflare Workers runtime constraints such as no filesystem and 30-second execution limits. - Use Case: You need to call the OpenAI API from your Expo app without shipping the API key in the client bundle. Create app/api/ai+api.ts with a POST handler that reads process.env.OPENAI_API_KEY, deploy with eas deploy, and call /api/ai from your React Native components. ## Quick Start Use the expo-api-routes skill to create an API route at app/api/hello+api.ts that returns a JSON greeting and show me how to test it locally with npx expo serve.

Frequently Asked Questions about expo-api-routes

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an API route in Expo Router?▼

Create a file with the +api.ts suffix inside the app directory, such as app/api/hello+api.ts, and export named functions for each HTTP method like GET or POST. Each function receives a standard Request object and returns a Response, for example Response.json({ message: "Hello" }).

How do I deploy Expo API routes to production?▼

Deploy Expo API routes to EAS Hosting by installing eas-cli, logging in with eas login, and running eas deploy. Set production secrets with eas env:create --name KEY --value xxx --environment production or through the Expo dashboard.

When should I not use Expo API routes?▼

Avoid API routes when data is already public, no secrets are required, or you need real-time updates via WebSockets. For simple CRUD, managed backends like Supabase or Firebase are better fits, and file uploads should use direct-to-storage presigned URLs.

Can I use Node.js modules like fs in Expo API routes?▼

No, Expo API routes on EAS Hosting run on Cloudflare Workers, which lack the Node.js filesystem and native modules. Use Web APIs instead, such as crypto.subtle for hashing and standard fetch for HTTP requests, and cloud databases like Turso or Cloudflare D1 for storage.

How do I handle dynamic route parameters in Expo API routes?▼

Use bracket syntax in the filename, such as app/api/users/[id]+api.ts, and receive the parameter as the second argument to your handler: export function GET(request, { id }). The id value comes from the URL path segment.

How do I test Expo API routes locally?▼

Run npx expo serve to start a local server at http://localhost:8081 with full API route support. Test endpoints with curl, for example curl http://localhost:8081/api/hello or a POST with a JSON body and Content-Type header.