Reputation:
In rails, I want to separate model, view and control into two parts and put them on two different servers. Can I achieve this by REST? How should I do?
Upvotes: 0
Views: 142
Reputation: 99957
Normally, MVC web development is independent of the REST architectural style—MVC is usually used to implement the back-end serving of a resource's representation. It is possible, though, to model each of M, V, and C as resources:
Any model resource can accept a GET operation to query its state, a PUT operation for setting its state, POST for appending to it, and DELETE for removal. You still have the problem of representing the state without a view resource.
A view resource can return a representation of a given state (in some bare-bones representation or something, like with XML) via a POST operation, I guess, unless the view's data is small enough to use a GET operation.
A controller resource can accept a GET operation for queries and POST for form processing.
I don't think that this makes much sense to do, unless you're building some kind of loosley-coupled, heavily cached, distributed MVC engine.
Upvotes: 1
Reputation: 49656
I'm assuming you mean two different RESTful resources exposed through Rails? (not sure from the wording)
Easiest way would just be to create two separate rails applications - one for each resource to be exposed, and deploy them to different servers. They could even both point at the same database if required, or they could have their own each.
Upvotes: 1