I have been wondering whether this combination of technologies would work. I can implement a modular web application with MVC, EF, and utilize AngularJs if I would want to play around with the technology to implement sort of a mini SPA. I would like to extend my knowledge a bit further, and I was wondering whether I could utilize node.js instead of EF for relational database communication. Can I intermingle MVC back end with AngularJs for front end (mixed with MVC), and node.js for database communications
-
1When you say "MVC" are you referring to ASP.NET MVC? "MVC" all by itself is a software architectural pattern, not a specific technology.mhodges– mhodges2016-08-01 16:19:57 +00:00Commented Aug 1, 2016 at 16:19
-
1your question is all over the map. node.js isn't a replacement for Entity Framework.....Claies– Claies2016-08-01 16:33:06 +00:00Commented Aug 1, 2016 at 16:33
-
So, what you are suggesting is technically possible, but highly impractical. It would require your server to be running two instances of a server-side framework and to be configured to listen on different ports for each one, and then synchronize data/logic between the two. TLDR; don't do this.mhodges– mhodges2016-08-01 16:35:19 +00:00Commented Aug 1, 2016 at 16:35
-
1@lucas Yes, that is semi-correct - technically node would be a replacement for IIS, which is the server that ASP.NET runs on, but any server-side code to handle http requests, DB calls, etc. running on node.js would be a replacement for ASP.NET. And again, MVC is simply an architecture.mhodges– mhodges2016-08-01 16:51:38 +00:00Commented Aug 1, 2016 at 16:51
-
1@lucas As for RDBMS for node.js, a quick google search will get you some common results, but you can also check out the rdbms keyword on the npm site. Some examples include MySQL, postgreSQL, etc. link is here: npmjs.com/browse/keyword/rdbms -- see also this link for MySQL for node article: sitepoint.com/using-node-mysql-javascript-clientmhodges– mhodges2016-08-01 17:01:21 +00:00Commented Aug 1, 2016 at 17:01
1 Answer
Is it possible? Yes, technically, but it would be very bad practice.
ASP.NET's MVC does nearly everything server-side. This means that views are built within the server and sent to the user. The controller is also server side.
With AngularJS, this paradigm is flipped on its head. The controller and view are both client side. The server sends the user all of the views and controllers at once, and then from then on only serves data. This is very attractive for single-page applications, and sites that want to exchange data, but not have to constantly send a new view. NodeJS is a popular architecture to use for the server, but any server architecture will work fine with Angular.
Both systems have their pros and cons, but there is no sane reason I can think of to use them together. You can certainly use ASP.NET as the server/model for an AngularJS application, but I'd discourage you from using APT.NET MVC with Angular.