0.3.10 • Published 3 years ago
to-api v0.3.10
to-api
Library to-api
generates REST API client with fetch
under the hood.
Usage
import create from 'to-api';
const clientApi = create({ baseUrl: 'http://api/users' });
clientApi
.addHeader('Authorization', 'bearer ...')
.processResponse(({ data }) => data);
const usersClient = clientApi({
create: 'POST /',
updateById: 'PUT /:id',
deleteById: 'DELETE /:id',
find: '/',
findById: 'GET /:id'
});
(async () => {
const newUser = await usersClient.create({ email: 'user@example.com' });
const user = await usersClient.findById({ id: 'user-id' });
})();
More examples you can find in tests.
0.3.9
3 years ago
0.3.10
3 years ago
0.3.8
3 years ago
0.3.7
4 years ago
0.3.6
4 years ago
0.3.5
4 years ago
0.3.4
5 years ago
0.3.3
5 years ago
0.3.2
5 years ago
0.3.0
5 years ago
0.3.1
5 years ago
0.2.5
6 years ago
0.2.4
6 years ago
0.2.3
6 years ago
0.2.2
7 years ago
0.2.1
7 years ago
0.2.0
7 years ago
0.1.5
7 years ago
0.1.4
8 years ago
0.1.3
9 years ago
0.1.2
9 years ago
0.1.1
9 years ago
0.1.0
9 years ago
0.0.4
9 years ago
0.0.3
9 years ago
0.0.2
9 years ago
0.0.1
9 years ago