I have an established NextJS application that heavily relies on Next's API routes. My goal is to transition the current codebase to function in a mobile environment. I've experimented with Capacitor and attempted to export it as a static site, but encountered issues when running it on a mobile device due to failures in accessing Next's API routes - which was expected since Capacitor only compiles the client-side code.
Is there a solution to this dilemma? I briefly tried redirecting the API requests to a hosted Next instance I have running when the app is in static site mode, but faced validation problems with cookies and requests. Setting up a proxy server crossed my mind, but it seems like a labor-intensive task, especially considering Next's default proxy setup isn't effective for this scenario.
Does anyone have insights on whether Capacitor or Expo offer a means to build and operate the entire Next application (including API routes) within the same mobile platform context? Essentially, having access to both the API routes and client-side components seamlessly within the mobile runtime?
Appreciate any assistance offered 🙏