REST Application and Web Application

80 views
Skip to first unread message

vivek gs

unread,
Apr 21, 2015, 8:04:14 AM4/21/15
to nod...@googlegroups.com
Hi,
 
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.
2. What is the best method to follow these type of scenario.
3. If any one can give me some kick start or some initial starting hint and best methods that would be great.

Vivek

// ravi

unread,
Apr 21, 2015, 4:53:09 PM4/21/15
to nod...@googlegroups.com
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

vivek gs

unread,
Apr 22, 2015, 9:46:58 AM4/22/15
to nod...@googlegroups.com
Thanks for your replay.

There will be lot on traffic in both REST API's and WEB so i have created a two node instance and running in different port and with different routes, so that I can configure in nignx to redirect to same application.

For both the API and WEB application DB will be same. SO I am thinking to create a separate folder for models and methods(CRUD) that can be used for both API and WEB.

Any comments.

vivek gs

unread,
Apr 22, 2015, 9:47:14 AM4/22/15
to nod...@googlegroups.com
Thanks for your input


--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/10F6AA2B-0B25-4C62-9DC4-33310E7891E9%40g8o.net.
For more options, visit https://groups.google.com/d/optout.



--
Regards,
VIVEK
Software Developer
Bangalore

Anthony Jackman

unread,
Apr 22, 2015, 9:47:16 AM4/22/15
to nod...@googlegroups.com
Ravi,

I agree with your last comment above. My first civilian web programming job was at a compny where we all were forbidden to use IDEs like Dreamweaver. Our boss at that time, said those IDEs and subsequent programming flow make you oblivious to all the code underneith (html4, css2, and javascript). I have always advised strongly to people wanting to learn to program, no matter the language, to take it back to basics without the help of groupd frameworks.

Thank you for suggesting to learn the underlying parts by themselves before attempting something like MEAN.

Tony
Reply all
Reply to author
Forward
0 new messages