Skip to content

tamer2025ultimate/lexcora_backend_native_dev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lexcora_backend_native_dev

Connecting the mobile client to the backend

  1. Start the backend

    • cd lexcora-backend && npm install
    • Copy the provided .env (contains database, AWS, JWT, OpenAI, etc.) and keep it out of source control in production.
    • Run npm run dev to expose the API on http://localhost:8080 (it responds under /api).
    • CORS_ORIGINS can be used when you need to whitelist extra front-ends, but the default local origins now include Expo Web on 19006, and the server logs the resolved list in non-production environments to help you spot missing hosts.
  2. Point the Expo app to the right base URL

    • cd lexcora-mobile && npm install.
    • Edit lexcora-mobile/.env and set EXPO_PUBLIC_API_BASE_URL to the URL your app can reach.
      • Android emulator (10.0.2.2): EXPO_PUBLIC_API_BASE_URL=http://10.0.2.2:8080/api
      • iOS simulator or desktop Node (localhost or 127.0.0.1): http://127.0.0.1:8080/api
      • Expo Web (localhost:19006): http://localhost:8080/api or point to the machine’s LAN IP if you need to hit the server from another device; the backend now allows the Expo dev origin by default.
    • Run expo start (or expo start --web) then use the login screen; the requests use nativeAxios, which picks the URL from EXPO_PUBLIC_API_BASE_URL and gracefully falls back to https://api.lexcora.com/api if nothing is configured.
  3. Keep the connection safe

    • For production, continue using https://api.lexcora.com/api so that every request goes over TLS.
    • If you change the host/port of the backend (PORT, FRONTEND_URL, CORS_ORIGINS), restart the server so the middleware rehydrates the origin list.
    • The app already clears stored tokens when a 401 comes back, so any repeated failures after login mean the client cannot reach the backend; double-check the base URL, the emulator’s networking (e.g., 10.0.2.2 for Android), and the CORS log emitted by the backend at startup.

About

a mobile app using React Native (Android)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published