gc-http-factory
- 授权协议: MIT
- 开发语言: JavaScript
- 操作系统: 跨平台
- 软件首页: https://gocardless.com/blog/gc-http-factory/
- 软件文档: https://github.com/gocardless/gc-http-factory
软件介绍
gc-http-factory 是一个 AngularJS 的扩展,提供更便利的 API 写法,例如常规我们定义一个 Service 的方法如下:
angular.app('app', []).factory('UsersService', function($http) {
function findOne(id) {
return $http.get('/api/users/' + id);
};
function findAll() {
return $http.get('/api/users');
};
function create() {
return $http.post('/api/users');
};
return {
findOne: findOne,
findAll: findAll,
create: create
};
});
而使用 gc-http-factory 后可以这样写:
angular.app('app', ['gc.httpFactory']).factory('UsersService', function(HttpFactory) {
return HttpFactory.create({
url: '/api/users/:id'
}, {
findOne: { method: 'GET' },
findAll: { method: 'GET' },
create: { method: 'POST' }
});
});
调用方法:
UsersService.findAll(); //=> GET /api/users
UsersService.findOne({
params: { id: 2 }
}); //=> GET /api/users/2
UsersService.create({
data: { name: 'Jack' }
}); //=> POST /api/users with { name: 'Jack' } as data
进化式运营:从互联网菜鸟到绝顶高手
李少加 / 电子工业出版社 / 2016-11 / 59
互联网运营作为一个新兴的岗位,一方面它是企业的核心岗职,身负重任,另一方面,又由于其短暂的历史,缺乏成熟体系的工作方法论,而目前业界主流的运营方法却是从企业视角出发,存在极大的改进空间。 《进化式运营:从互联网菜鸟到绝顶高手》作者基于自身十年的互联网洞察、实践经验,并融合了信息论、心理学、经济学、管理学、甚至包括生态学、进化论等跨学科跨学业的知识,从无到有地构建了一套全新的互联网运营体系:基......一起来看看 《进化式运营:从互联网菜鸟到绝顶高手》 这本书的介绍吧!
