expo-api-routes

作者: expo

在 Expo Router 中使用 API 路由處理伺服器端邏輯、機密資料及第三方整合,適用於 EAS Hosting。在 app 目錄中建立以 +api.ts 結尾的路由;匯出名稱對應的 HTTP 方法函式(GET、POST、PUT、DELETE)。處理查詢參數、標頭、JSON 主體及動態路由區段;為網頁客戶端加入 CORS 標頭。透過 process.env 存取伺服器端機密;在本地 .env 中設定變數,或透過 eas env:create 為正式環境設定。使用 eas 部署至 EAS Hosting(Cloudflare Workers)。

npx skills add https://github.com/expo/skills --skill expo-api-routes

來自 expo 的更多技能

expo-upgrade
expo
框架(開源)。升級 Expo SDK 版本與修復相依性問題的指南。
apidevelopmentofficial
expo-data-fetching
expo
Framework (OSS). Use when implementing or debugging ANY network request, API call, or data fetching. Covers fetch API, React Query, SWR, error handling, caching, offline support, and Expo Router data loaders (`useLoaderData`).
official
android-e2e-testing
expo
使用 ADB 在 Android 模擬器上測試 Expo Router 功能。在實作原生 Android 功能後或驗證 Android 上的 UI 行為時使用。
official
expo-dev-client
expo
透過 EAS Build 或在本機端建立自訂 Expo 開發用戶端,以便在實體裝置上測試原生程式碼。僅在使用自訂原生模組、Apple 目標(小工具、App Clips)或 Expo Go 中未包含的第三方原生程式碼時才需要;請先嘗試使用 npx expo start 執行 Expo Go。支援雲端建置並自動提交至 TestFlight,或在本機端建置,輸出 .ipa(iOS)或 .apk / .aab(Android)檔案。需要在 eas.json 中設定包含開發設定檔的組態,該設定檔會設定...
official
android-jetpack-compose
expo
Use when building Android UIs with Jetpack Compose, managing state with remember/mutableStateOf, or implementing declarative UI patterns.
official
swiftui-expert-skill
expo
編寫、審閱或改進SwiftUI程式碼,遵循狀態管理、視圖組合、效能、macOS特定API及iOS 26+ Liquid…的最佳實踐。
official
android-e2e-testing
expo
Test Expo Router features on Android emulators using ADB. Use after implementing native Android features or when verifying UI behavior on Android.
official
expo-api-docs
expo
為Expo SDK API編寫符合官方慣例的TSDocs註解。在expo-*套件中引入新的使用者導向TypeScript API時必須使用——文件…
official