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
测试驱动开发的艺术
Lasse Koskela / 李贝 / 人民邮电出版社 / 20101023 / 59.00元
在传统的软件开发中,开发人员对于代码是否正确心中无底,一切依赖于后期的测试环节。极限编程反其道而行之,主张采用测试驱动开发(TDD)的方法,即通过测试定义所要开发的功能的接口,然后实现功能的开发过程。TDD通过不断地测试推动代码的开发,既简化了代码,又保证了软件质量。 本书采用“手把手”的教学方式,通过大量实例来解释TDD,还专门用几章的篇幅来讲解如何为难于测试的技术编写单元测试。全书内容循......一起来看看 《测试驱动开发的艺术》 这本书的介绍吧!
