Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I've googled for few days, some tutorials talking about using ember-cli to build an ember app, but most of them are teaching me to separate the server into two.

That is, one for providing the API endpoint to query the database (with custom express server, mongoDB...), and one for hosting the website (with ember-cli), it means that I have to start two node.js backend servers to serve one website.

Can I do it in one node.js app?

share|improve this question
    
Sure, you can actually run as many websites as your server can handle from a single node.js app with express and the vhost middleware. Of course, if you wanted your website to be served from the same domain as your api, then you don't even need the vhost middleware. –  Kevin B Mar 9 at 15:01

1 Answer 1

Yes, the only limit to how many "sites" you can run in a single node.js app is based on the hardware of your server. Even the smallest of servers should be able to handle running your api + the website endpoints in one node.js app.

However, what you have isn't two node.js apps, you have an express.js api, and then an ember-cli webapp. It isn't built in such a way that it would be easy to simply consume your ember-cli webapp with your api or the other way around, so i'd have to go with "Yes, it is probably possible", however, good luck making it happen.

I would avoid trying to combine them.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.