Here, I come back with Nodejs and MVC concept. Yes, I want to use Nodejs modules more easy and flexible way. Before get into deep, just go through the following diagram.
Unlike PHP+Apache, In NodeJs, the code is live until the application terminate once application is started. So any careless code will leads to memory-leaks. So before start, we have to plan about structure of project. That is, there should be clear definition about place of modules and how they are going to communicate each other. So here, I have proposed a design with support MVC which is showed in diagram. There is three kind of modules, First one is core modules like http, fs and more. Second one is contributed modules like request, underscore and more. And third type is custom modules which are developed by application developer. I have to organize these three modules in right folder/directory. Luckily, Core modules are comes with NodeJs installation setup. And Contributed modules are placed in folder named with "node_modules" by NPM. So I have to take care only about custom modules.
Here, I feel keep those custom modules or files in separate folder without joining them as a part of contributed module. I called this separate folder as "Application" which is showed in diagram. Since I have control over my code, I divide them three part to support MVC and organize the code in files based on their responsibilities.
And more, as showed in diagram, I would like to keep the communication of those modules in application folder more strong and communication of modules between "Application" folder and "node_modules" folder is in comfortable level. I mean, On incoming request the modules in "Application" folder talks strongly within themselves. In another word, during the application start-up, the modules within "node_modules" folder interact each other and generate a base. The modules in "Application" folder are interact often, that means on every request. Since "Express" module has great control on handling routing, session and request body parsing, I am using "Express" to gain controller advantage. Overall, The system handles the request with respective to MVC.
Github: https://github.com/hilarudeens/NodeJs-BasicServer-MVC
Note: You can fork it at anytime. Help to improve the code.
Output: Folder view
ReplyDeleteThanks for sharing superb one. I'm always keeping this idea in mind.
QTP Training in Chennai
QTP Course in Chennai
QTP Training in Porur
LoadRunner Training in Chennai
performance testing training
DOT NET Training in Chennai
.net coaching centre in chennai
Html5 Training in Chennai
I am really enjoying reading your well written articles.
ReplyDeleteIt looks like you spend a lot of effort and time on your blog.
I have bookmarked it and I am looking forward to reading new articles. Keep up the good work..
PHP Training in Chennai
PHP Course in Chennai
Angularjs Training in Chennai
CCNA Training in Chennai
ui design course in chennai
Salesforce Training in Chennai
web designing training in chennai
Tally Course in Chennai
There are a number of plays of food show. This show is the greater podcast that can be watched at YouTube also. You would also like to listen about the Company where I do job which provides best creative writer India which can make your show more popular. New Gutter Installation company
ReplyDeleteThis is a very helpful blog for one who needs to learn in a short span of time.
ReplyDeleteSpoken English Classes in Chennai
Best Spoken English Classes in Chennai
Spoken English Class in Chennai
Spoken English in Chennai
English Speaking Classes in Mumbai
English Speaking Course in Mumbai
IELTS Coaching in Chennai
IELTS Coaching Centre in Chennai
IELTS Classes in Mumbai
IELTS Coaching in Mumbai
I am glad that I saw this post. It is informative blog for us and we need this type of blog thanks for share this blog, Keep posting such instructional blogs and I am looking forward for your future posts.
ReplyDeleteCyber Security Projects for Final Year
JavaScript Training in Chennai
Project Centers in Chennai
JavaScript Training in Chennai
Thanks for your nice post, i am interested to learn online freelancing, but firstly i have to learn computer , could you suggest me please which computer training center best.
ReplyDeleteDot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery
Your blog have very good information regarding the led light, I also have some worth information regarding led bulb, I think this info will be very helpful for you.
ReplyDeleteangular js training in chennai
angular js online training in chennai
angular js training in bangalore
angular js training in hyderabad
angular js training in coimbatore
angular js training
angular js online training