2021-07-03 13:56:53 +00:00
|
|
|
import config from '../config.mjs'
|
2017-12-09 21:51:18 +00:00
|
|
|
|
2021-10-11 00:21:57 +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('/error', this.error.bind(this))
|
|
|
|
}
|
|
|
|
|
2021-10-11 00:21:57 +00:00
|
|
|
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
|
|
|
}
|
2021-07-03 13:56:53 +00:00
|
|
|
|
2021-10-11 00:21:57 +00:00
|
|
|
error(ctx) {
|
|
|
|
throw new Error('This is a test')
|
|
|
|
}
|
2021-07-03 13:56:53 +00:00
|
|
|
}
|