Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript MVC framework (seperation of concerns) is compatible with asp.net MVC?

Anyone had a chance to use the javascript MVC framework with ASP.NET MVC?

Basically i looking for advise on a way of using them together if possible, my asp.net MVC app i can't get rid of but i would love to use some sort of separation of concern for the javascript / Jquery...

Anybody used something like this? I am trying to picture the 2 together, because asp.net mvc provides VIEWS maybe the 2 would be incompatible....??

Or would it be better to use just a OOP extension framework for javascript and if so ... anybody know a good one that would work side by side with asp.net mvc?

like image 465
mark smith Avatar asked Apr 08 '09 13:04

mark smith


2 Answers

Mark, I'm another contributor to JMVC. JMVC is designed to work from raw data services, but it can wear many hats.

It's based on thin server architecture. For example, instead of splitting creating views on both the server and the client, use asp.net to create raw JSON data, then pass it to JavaScript, which will use its templates to generate the final HTML structure.

The advantage is that you've already created a reusable service, and your UI logic is all in one place (the client).

However, you don't have to do things this way. You can decide where the best place to create view data.

If your views are all server side (returning HTML from client requests), you might not even need many JMVC views. You would just use controllers. However, controllers are the best part of JMVC. They use event delegation so you don't have to worry about attaching events!

Here's a post where I talk about our architecture with rails:

http://javascriptmvc.com/blog/?p=68

like image 124
Justin Meyer Avatar answered Sep 20 '22 01:09

Justin Meyer


I'm one of the JMVC guys. Yes you can use those two together. We advice using REST services to separate your client/server layers, as it provides the cleanest separation for your data. With REST you'd consume data with your client by making requests for all todos, which would come back as JSON. JavaScriptMVC would then call a callback to your controller, and you'd use a client side template (view) to render the data.

The two are definitely compatible, but it depends on where you want your logic to exist. A thick client has many advantages, including scalability and maintainability.

like image 27
moschel Avatar answered Sep 21 '22 01:09

moschel