Pratik Agarwal
Pratik Agarwal

Reputation: 348

Running Mongo Node Angular on same server

Can I / Should I host Angular, Node-express and Mongo on same server, say localhost:3000 or somehosting.com/server-address?

Also is it a good practice? I've seen Angular and Node running on same server, but what about adding mongo too?

like everything equivalent to

mongodb://localhost:3000/db
ng serve --port 3000
server listen(3000)

Thanks

Upvotes: 1

Views: 647

Answers (2)

Anand Sowmithiran
Anand Sowmithiran

Reputation: 2920

As you have not mentioned for what purpose - the answer will be depending on the purpose and context. If you are learning, then running webserver, database and serving Angular static files , all from the same server is not an issue. However, if you are going to have live web app, even with less or moderate traffic, then you must run database on its own server, and the webserver and static Angular files from one server. Of course, for SPAs that expect lot of traffic and real use, it is better to serve your static Angular files from a CDN or storage service like AWS S3, and web and database servers separately.

Happy learning!

Upvotes: 2

R2D2
R2D2

Reputation: 10697

It is best practice to keep the databases(stateful) in different servers then the applications(stateless) unless it is just for testing...

Upvotes: 1

Related Questions