restful backend framework for backbone.js and co
what's left to do for a backend framework in order to provide a restful service to a frontend application based on backbone.js or other full MVC frontend framework?
I can think of
- data
- storage
- versioning
- validation
- authorization
- (refential) integrity
开发者_如何学C
- user authentication
- event notification to client
what else?
A few additional things (though any could probably be considered parts of things you've already mentioned in the question):
Acting as an intermediary
As long as we have domain restrictions on Ajax, it will be necessary to offer a proxy to enable mashups. Even once we fix that problem, though, there are other cases for an intermediary. Take, for example, Twitter's streaming API. Twitter only allows one stream per API key, so your backend app will have to be the consumer that then sends search results to the clients.
Search
Bandwidth and client processing capabilities both limit the degree to which search can be done on the client.
Jobs
Background or batch job processing is often best done on the server. A good RESTful practice is to POST
to /jobs
, get a 202 Accepted
with a Content-Location
header pointing to the running job. Subsequents to that job return a status and, if it's complete, a link to the results.
The one thing that is very important to consider when moving to a front end powered architecture, is that in many cases you will need to generate content for search engines.
So ideally your architecture is capable of routing and evaluating templates / views on the server side. I think this ability to use the same logic on client and server side is something that is very lacking at the moment.
It looks like you pretty much have the backend tasks all listed there, but this new architecture does bring further detail into how you need to do these things, so it's not necessarily as easy as it the list makes it seem.
精彩评论