storage-upload/api/test/routes.mjs

34 lines
693 B
JavaScript
Raw Permalink Normal View History

import config from '../config.mjs'
2017-12-09 21:51:18 +00:00
export default class TestRoutes {
constructor(opts = {}) {
Object.assign(this, { })
}
2022-08-13 21:52:45 +00:00
register(server) {
server.flaska.get('/', this.static.bind(this))
server.flaska.get('/health', this.health.bind(this))
2022-08-13 21:52:45 +00:00
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'),
}
2017-12-09 21:51:18 +00:00
}
error(ctx) {
throw new Error('This is a test')
}
}