NodeJS How to seperate Web Server from API


My application will need to serve static content and also expose an API for serving and posting data. How do I separate these into different NodeJS process/instances but have them use the same port and base URL

From what I’ve read, I could use Nginx to accomplish this but I’m worried about how I’ll deploy this to hosts like Heroku.

Thanks all.

Did you do this project? (Image abstraction layer)

My GitHub repo

No, why? My application is not on the Free Code Camp curriculum.

Welcome to the Free Code Camp forum

Thank you, though I’ve been here for a while?

I just think this project covers the tasks you want doing with your application, maybe?

It asks you to build a full stack application (which I am), but does not detail or require you to split the API from the web server. Though I think I may have figured it out.

Something like Niginx or Apache can be used as a proxy and from what I’ve read, they can be deployed to amazon AWS. I’ll give these a try.

1 Like

Valuable information in your answer and I really appreciate your work
Thank you