Last active
February 21, 2018 17:36
-
-
Save madorb/c71488f6b27ed86a9a43b3cde3761be3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import { Pageable, IndexablePage, paginate } from '@panderalabs/koa-pageable'; | |
import type { Context } from 'koa'; | |
import Koa from 'koa'; | |
import Router from 'koa-router' | |
const app = new Koa(); | |
const router = new Router(); | |
app | |
.use(router.routes()) | |
.use(router.allowedMethods()); | |
router.get('/people', paginate, async (ctx: Context) => { | |
const pageable: Pageable = ctx.state.pageable; | |
const result: IndexablePage<number, Person> = service.getData(pageable); | |
ctx.body = result; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment