How to host api and frontend sepaparetly while using the same domain ??

Rocktim Saikia - Aug 16 '20 - - Dev Community

I have express API repository which is currently hosted in Heroku along with its documentation site written in ejs.

But now I'm planning on separating the docs website with gatsby and moving it into another repo and hosting it on Netlify while the API service still remains in Heroku.

Here is the end goal :

//example domain: example.com

"/" 
// example.com/ : serves the docs website.(Netlify)

"/api"
// example.com/api : serves the API services. (Heroku)
Enter fullscreen mode Exit fullscreen mode

Can someone help me with how to implement this in the actual application? I am not very familiar with separating hostings while using the same domain.

. . . . . . . . . . . . . . . . . . .
Terabox Video Player