storage-upload/api/test/routes.mjs
Jonatan Nilsson 7755847af3
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
server: Add specific health check route that doesn't spam logs
2022-08-15 08:39:59 +00:00

33 lines
693 B
JavaScript

import config from '../config.mjs'
export default class TestRoutes {
constructor(opts = {}) {
Object.assign(this, { })
}
register(server) {
server.flaska.get('/', this.static.bind(this))
server.flaska.get('/health', this.health.bind(this))
server.flaska.get('/error', this.error.bind(this))
}
health(ctx) {
ctx.body = {
name: config.get('name'),
version: config.get('version'),
environment: config.get('NODE_ENV'),
}
}
static(ctx) {
ctx.body = {
name: config.get('name'),
version: config.get('version'),
environment: config.get('NODE_ENV'),
}
}
error(ctx) {
throw new Error('This is a test')
}
}