3.0.4 • Published 3 years ago
sutro-client v3.0.4
sutro-client
A simple and sugary client for using sutro APIs.
Install
npm install sutro-client --save
Example
sutro
Server
{
user: {
create: async ({ data }) => User.create(data),
find: async ({ options }) => User.findAll(options),
findById: async ({ userId }) => User.findById(userId),
updateById: async ({ userId, data }) => User.updateById(userId, data),
replaceById: async ({ userId, data }) => User.replaceById(userId, data),
deleteById: async ({ userId }) => User.deleteById(userId),
friend: {
create: async ({ userId, data }) => {
const me = await User.findById(userId)
await me.addFriend(data)
return me
},
find: async ({ userId, options }) => {
const me = await User.findById(userId)
return me.findFriends(options)
},
findById: async ({ userId, friendId }) => {
const me = await User.findById(userId)
return me.findFriendById(friendId)
}
}
}
}
sutro-client
Output
import client from 'sutro-client'
const api = client(server.meta)
/*
All functions return promises:
api.user.create()
api.user.find()
api.user.findById()
api.user.updateById()
api.user.replaceById()
api.user.deleteById()
api.user.friend.create()
api.user.friend.find()
api.user.friend.findById()
*/
3.0.4
3 years ago
3.0.3
3 years ago
3.0.2
3 years ago
3.0.1
3 years ago
3.0.0
3 years ago
2.2.3
3 years ago
2.2.1
3 years ago
2.2.0
3 years ago
2.1.5
3 years ago
2.1.4
3 years ago
2.1.2
3 years ago
2.1.1
3 years ago
2.1.3
3 years ago
2.0.5
3 years ago
2.1.0
3 years ago
2.0.4
3 years ago
2.0.3
3 years ago
2.0.2
3 years ago
2.0.0-beta.1
3 years ago
2.0.0-beta.0
3 years ago
2.0.1
3 years ago
2.0.0
3 years ago
1.6.2
3 years ago
1.6.1
4 years ago
1.6.0
4 years ago
1.5.1
4 years ago
1.5.0
4 years ago
1.4.0
4 years ago
1.3.0
4 years ago
1.2.4
5 years ago
1.2.3
5 years ago
1.2.2
5 years ago
1.2.1
5 years ago
1.2.0
5 years ago
1.1.0
5 years ago
1.0.6
5 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago