0.2.1 • Published 4 months ago
@head/edge v0.2.1
@head/edge
// service.js
import Application from '@head/edge';
import $rpc from '/path/to/user-rpc';
const { router, client } = new Application();
router.verb('GET', '/api/users', async (ctx, next) => {
const data = await $rpc.doPost('/path-to/userService');
ctx.body = data;
next();
});
export default client;
// store.js
import $client from './service';
async function init() {
const data = await $client.get('/api/users');
state.users = data;
}