identical urls page vs api
Noob question -
If my site has a page at /posts, but my api also has a /posts route. Is it possible to differentiate? Should I prefix all my api routes like /api/posts for example?
7 Replies
I guess this wouldn’t happen if my api is on a different server, I could add a subdomain api.domain.com/posts
using next?
or what tech?
@Neto going to be using nextjs for frontend and express for my backend. Turbo repo and prisma (guess that’s not really relevant)
If you where using next for both
/some would be a page
/api/some would be a API route
But as they are different applications, a subdomain is enough
Ok cool
Is there any other alternative?
Or is subdomain the go to if express is living on its own on a server
For a simple approach, just use the subdomain
Ok 👌 sounds good
Thx