move error handler to before middlewares
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
f10c1caf70
commit
8846e1e206
10
src/app.js
10
src/app.js
|
@ -9,16 +9,16 @@ const App = (ghc) => {
|
|||
const app = new Koa()
|
||||
const router = new JoiRouter()
|
||||
|
||||
app.on('error', (err, ctx) => {
|
||||
console.error('server error', err, ctx)
|
||||
})
|
||||
|
||||
app.use(Logger())
|
||||
.use(JSON({pretty: true}))
|
||||
.use(JsonError())
|
||||
.use(router.middleware())
|
||||
.use(BodyParser({onerror:console.error}))
|
||||
|
||||
app.on('error', (err, ctx) => {
|
||||
console.error('server error', err, ctx)
|
||||
})
|
||||
|
||||
|
||||
router.get('/health', async (ctx) => {
|
||||
ctx.body = 'OK'
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue