@eyedea/syncano
Custom wrapper for @syncano/core library.
Install
$ npm install --save @eyedea/syncano
Usage
import * as S from '@eyedea/syncano'
interface Args {
id: string
}
class Endpoint extends S.Endpoint<Args> {
async run(
{data, response /* users, endpoint etc. */}: S.Core,
{args, meta, config}: S.Context<Args>
) {
if (!this.user) {
throw new S.HttpError('Unauthorized!', 401)
}
return data.post.find(10)
response.json({posts}, 200)
}
endpointDidCatch({message}: Error) {
this.syncano.response.json({message}, 400)
}
}
export default ctx => new Endpoint(ctx)
Tests
View @eyedea/syncano-test
License
MIT © Eyedea AS