7 months ago

Best way to host API routes and client app on same domain

Posted 7 months ago by aschorr

I'm developing a web app, using Laravel to develop the API and admin panel, and another framework for the web client app (next.js/now). I'd optimally like to host them all on the same url:

Api requests would optimally go to (for example), and the actual web app would route to my next.js, hosted elsewhere, (routes like for example). I assume since much of the server layer is abstracted away if I deploy with Forge, so this wouldn't be possible. However the next best option would be putting my API and admin routes behind subdomains - and respectively.

However I'm curious how I could ensure that routes to the root url, simply are passed through to my client app (next.js hosted with now)?

Please sign in or create an account to participate in this conversation.