MVC approach in Node.js - node.js

Currently I am working on Node.js using the MVC type of model, as it is easier to segregate the code into modules.
What I am looking for is a better approach apart from MVC, so that the code can be easily debugged and understandable.
Please advise.

I've used quite a few different frameworks but I've always found Sails.js to be the best MVC Framework for Node, easy to learn and offers a lot, its basically express with a lot of middleware but they make creating Controllers, Models and what not very easy with their CLI, you can check our more here:
http://sailsjs.org/

Related

MVC practices through Node?

I'm a front-end developer with a desire to learn more on functional programming and template engine processing through JavaScrit.
I'm currently learning the Node platform, which I initiate through Visual Studio Code terminal to build custom JavaScript apps. But I want to take Node further. Does Node provide any good resources on building an MVC (Model View Controller) like applications?
Just to give a little background, I just finished a course in MVC 5 for ASP.NET (which I really enjoyed through Visual Studio 2017), but would like something similar to that which is JavaScript based.
Thanks for any recommended resources! I want to make sure what I am diving into gives me the end goal I am looking for.
Thanks again!
On top of node.js you can use different frameworks, one of the most important is express but there are many others, look at nodeframework.
Then I suggest to use some best practices. Personally I've found really useful the following for express:
https://github.com/i0natan/nodebestpractices#1-project-structure-practices

CRUD in Electron

Could you please give me a piece of advice about how to implement CRUD or DB(PouchDB) modifications using FORMs or any other efficient way in Electron?
The point is I would like whole application to behave as desktop tool and it seems to be possible in Electron. However I cannot determine the best way to do this especially if I would like to add to nice eye-candy tricks to make UX as smooth as possible.
First of all electron is not responsible for the visual appearance of your application. It is a framework which wraps your webapp into a desktop application.
That means you need to use standard web technologies (html/js/css) to create your site including 'eye-candy' and animations.
My suggestion is to do a tutorial which explains how to connect electron with a javascript framework like angular. If this is running you can attach a database and all the hot shizzle afterwards.
This tutorial is very good and well explained:
https://scotch.io/tutorials/creating-desktop-applications-with-angularjs-and-github-electron
enjoy!

Combining SailsJS and EmberJS (routing)

I've been using SailsJS for a while now and find it a perfect REST API solution. I'm currently building an app for both Web & Mobile (native) so I need the REST part of SailsJS. I want to build a frontend for my API right now, and I found EmberJS which looks like a promising framework. I've a question about combining those two, they both have their own Routing system, and SailsJS seems to overrule Ember's one.
My guesses would be:
The most easy approach looks like building Sails in a subdirectory
eg. /api/ but I think that's not the nicest way to get this fixed.
I could choose one framework for routing and let the other delegating it's routes. For example passing parameters from SailsJS through EmberJS
How can I use those together correctly?
Think of your backand as something you can't control, like a 3rd party API. The reason is that the optimal routing for a user may differ greatly from what's considered to be good API semantics. It's also not easy to share the route declarations, but it's not a good practice anyway.
My advice:
Use ember-cli to build the frontend. It's a great tool, you'll enjoy it a lot.
Build your Sails-based API in a different repository, using the /api namespace for your API endpoints.
Try to follow the JSON API standard as closely as possible. That'll make easier to connect your backend & frontend, as most data libraries (Ember Data for eg.) tries to adhere those standards as well.
Watch Luke Melia's excellent guide on lighning fast deployment. It'll be the same concept for you but in Sails intead of Ruby/Rails.
All in all, I think if you'll have a great dev experience if you do roughly what I've outlined above. Happy coding!

Why are some many node.js web frameworks building based on Express? Why Does Express do not implement those features?

I am a newcomer to node.js techique stack. I found some many articles are introducing node.js and Express. I know Express is a good web framework including template engine, routing, etc. It is popular and active framework. There are some point I am confused:
Why there are still so many web frameworks are built on Express? Is it lack of much features?
Why does Express do not evolve to add more features? Is it a lower-level web framework?
What are the product orientation for Express and others (which is built based on Express)?
Express is designed to only do a few things well. It will take care of routing and some templating for you, but it isn't a complete MVC solution. Since express takes care of a lot of basic middleware required for MVC frameworks, these frameworks are built on express.

Integrating Angular.js with Node.js (Express+Tower.js)

I am new to node. I very much like approach of AngularJS. I like what I see in towerjs.
Has Anyone wired the two together? I have in mind tower primarily for backend api/rest and angular for clientside.
I'm especially not familiar with tower.js, but from the docs it looks like it might not be practical to use the two together. There is quite a bit of overlap in the things AngularJS provides and the things tower.js provides (especially models, views, and controllers on the client).
I've written on how to use AngularJS with a RESTful API provided by Express on my blog. Maybe that can help you get started.
Good luck! :)
Tower is for the server-side while angular is on the client right?
So what you could try what is mentioned here. Just replace railway with tower.
You could check this brunch.io skelleton that uses angularjs.
Hope this comes in handy mate!
As things are evolving very fast, there are some major update.
For example, a framework named Total.js has made much work to make Angular.js work in hand with Node.js.
Please have a look at their web site http://www.totaljs.com/totalstack/ and at the 6 (!) example they provide on how to use it : https://github.com/totaljs/examples.
Pretty amazing! Hope that helps!
Note: I have no affiliation with Total.js at all.

Resources