api-routes
Guidelines for creating API routes in Expo Router with EAS Hosting
Security Assessment
Detected risks:
About api-routes
The 'api-routes' skill provides comprehensive guidelines for creating API routes using Expo Router in conjunction with EAS Hosting. It addresses the need for secure server-side operations, enabling developers to implement functionality that requires hidden secrets, such as API keys and database credentials. This skill helps in maintaining the integrity and security of applications by ensuring sensitive information does not reach the client-side while facilitating critical operations like database queries, server-side validation, and interactions with third-party APIs.
FAQ
When should I use API routes?
Use API routes when you need to handle server-side secrets, perform database operations, validate data, or interact with third-party services securely.
Can I use API routes for real-time updates?
No, for real-time updates, consider using WebSockets or services like Supabase Realtime instead.
What is the file structure for API routes?
API routes should be placed in the 'app' directory with a '+api.ts' suffix, e.g., app/api/hello+api.ts.
How do I handle CORS for web clients?
You can add CORS headers in your API route responses to allow access from web clients.
What should I do if I need to upload files?
For file uploads, use direct-to-storage solutions such as S3 presigned URLs or Cloudflare R2.
Install api-routes
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
expo/skills