sourcery - 构建JavaScript的RESTful API客户端
jopen
12年前
Sourcery是一个框架,用于构建RESTful API 客户端。它的思想源于ActiveResource 并行为几乎相同的方式。它的速度极快,非常简单易用。
var Resource = require('sourcery'); var Base = Resource.extend({ host: 'http://example.com/api/v1', // base host ext: 'json', // optional, will include `.json` in the URLs root: true, // optional, will include root element }); var Project = Base.extend({ path: '/projects', // http://example.com/api/v1/projects name: 'Project', // optional, this is the name for the root element });