expo-api-routes

Build Expo Router API routes under app/api with EAS Hosting deployment.

2|Updated Feb 27, 2020
One-click install
npx skills add https://github.com/nickcorin/dotfiles --skill expo-api-routes-nickcorin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: expo-api-routes
Source: https://github.com/nickcorin/dotfiles/tree/main/dot_config/opencode/skill/expo-api-routes
Command: npx skills add https://github.com/nickcorin/dotfiles --skill expo-api-routes-nickcorin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guidance helps developers implement secure, scalable server-side API routes for Expo apps using the Expo Router in the app directory, covering hosting, environment management, and robust request handling.

Core Features & Use Cases

  • Structured API routing: Organize endpoints under app/api with explicit HTTP methods (GET, POST, PUT, DELETE) and dynamic routes.
  • Secure hosting and deployment: Emphasizes environment variables, authentication patterns, CORS, and deployment workflows to EAS Hosting or edge runtimes.
  • Practical scenarios: Proxy external APIs, perform server-side validation, and protect secrets from client code.

Quick Start

Start building Expo Router API routes by placing endpoints under app/api with +api.ts files, configure environment variables, and test locally with 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 API routes in Expo Router?

Create Expo Router API routes by adding +api.ts files under the app/api directory to expose server-side logic. You define explicit HTTP methods like GET and POST within these files to handle incoming requests.

Can I securely hide environment variables and API secrets in Expo Router?

Yes, Expo Router API routes run server-side, allowing you to securely handle environment variables and protect API secrets from client code. This prevents exposing sensitive keys in your mobile application bundle.

Does Expo Router support dynamic API routes and different HTTP methods?

Expo Router supports dynamic API routes and explicit HTTP methods including GET, POST, PUT, and DELETE. You can structure these endpoints within the app/api directory to handle various server-side operations.

What is the best way to deploy Expo Router API routes to the cloud?

Deploy Expo Router API routes using EAS Hosting or edge runtimes to expose server-side logic securely. The deployment workflow covers everything from local testing with expo serve to cloud hosting.

How do I configure CORS and error handling for Expo API routes?

Configure CORS and error handling directly within your Expo API route files to manage cross-origin requests and catch server-side validation errors. This ensures robust request handling and secure responses.

Do I need EAS Hosting to test Expo API routes locally?

No, you do not need EAS Hosting to test locally; you can test Expo API routes using expo serve. EAS Hosting is utilized later in the deployment workflow for cloud hosting and production environments.