one api server, many apps?

55 views
Skip to first unread message

Tim Arnold

unread,
Mar 4, 2016, 10:28:01 PM3/4/16
to nodejs
I'm starting a MEAN project where the node/express server will be a REST api server, only sending json in response to the defined routes. 

I have one mongodb with several collections and a few client apps to query the collections.

Is it a bad idea to have one server that communicates several angularjs apps or should I keep things separated so I have a unique server for each client app? 

I'd set up nginx to reverse proxy in any case, whether I have a single node server or several.

I'm pretty new to node--on one hand I like the separation that several servers would provide, but if I'm only returning json from one mongodb server, why not have a single server with modularized routing code?

thanks,
--Tim

Christopher Mina

unread,
Mar 6, 2016, 4:38:29 PM3/6/16
to nodejs
I'd have no problem having a single API service. Just separate your API classes and routes well so it's easy to understand and maintain. You may end up having multiple servers, but running the same apps and services, only to ensure higher availability. As well, to future proof things, you may build it to ensure you can have multiple versions of your API down the line, so all apps don't need to be updated at once should a major refactoring of some sort take place. For instance, a service may be running at https://site.com/API/v1/service/method. If you ever made breaking changes to the API, you could build that at a v2 path and continue to support the v1 route as well.

Our company runs many apps, mobile and web, and they are all served by a single set of [versioned] APIs on a load balanced cluster at EC2.

Best of luck

Tim Arnold

unread,
Mar 7, 2016, 9:18:25 AM3/7/16
to nodejs
Thanks Christopher, that's exactly what I needed to know.
--Tim

Abhishek Kashyap

unread,
Mar 15, 2016, 8:28:26 AM3/15/16
to nodejs

hello 
i am currently working on node.js+express+psql+nginx app . I have created the both https And http in same app and uploaded it to the server.since uploding file each of the pages on http are running but the https had been stopped and its throwing the empty directory means it is not finding any js file from the public folder ......please help me..
Abhishek kashyap Jha
Reply all
Reply to author
Forward
0 new messages