Fetching
_ = require 'underscore' pagecontents = path: '/'contents: 'home' path: '/test'contents: 'test' path: '/about'contents: 'about' appfetchbind 'pagecontents''bypath' cb _pagecontentsfind pagepath is paramspath appfetchbind 'pagecontents''search' cb _pagecontentsfilter pagepathstartswith paramsterm or pagecontentscontains term
What is the problem?
When writing systems the way data is retrieved is not related to the logic. As a result it's useful to have some form of separation. Additionally how the information is presented is not important to how the data is retrieved.
How fetching solves this problem
- A clear separation of where information comes from is provided
app.fetch
provides an interface to register and retrieve information. - The results of this information can be made available as json, xml, or any other representation.
- Metadata is kept for debugging purposes.
Goals
- Simple
- One concept multiple specifications