On Apr 21, 2015, at 5:33 AM, vivek gs <
vivek...@gmail.com> wrote:
> I am new to node.js and MEAN Stack.
>
> I am developing an application which will have 2 part.
> 1. REST Application which I have created a REST API's for Mobile Client to send the json data. The API's will process the data and store it MongoDB.
> 2. WEB Application which will use the same MongoDB and it will show in browser.
>
> I have created a folder XYZ has my project name. Inside that I have created two folders api and web. In Web i am using a MEAN.JS has it is a frontend application and for Api I have started from scratch using express.js and other require modules.
>
> 1. How can I start the both application in different port.
Do they have to be on different ports? Why not use Express’s routing capabilities to serve both the REsT API and the web pages from a single web server instance?
XYZ <— root of your app
XYZ/api or XYZ/routes <— the API to your DB
XYZ/web or XYZ/static <— the web pages and browser side JS
> 2. What is the best method to follow these type of scenario.
The advice I’d give you is this: if you are new to NodeJS, and if you are writing a real app (not a demo app to learn the ropes), do not commit to platforms like MEAN, unless you are already proficient with Mongo and Angular, and want to leverage that expertise.
—ravi