Continue to implement #2698: - Add `core/base-service/index.js` (but hold off on moving the things it imports) - Add shortcuts in `services/index.js` for Base*Service, errors, and deprecatedService. This file will be streamlined later to avoid cluttering it with rarely used bits. - Apply consistent ordering of imports and use of `module.exports` in testers. - Remove some renaming of imports. - Remove obsolete tests here and there.
41 lines
775 B
JavaScript
41 lines
775 B
JavaScript
'use strict'
|
|
|
|
const { NonMemoryCachingBaseService } = require('..')
|
|
|
|
const serverStartTime = new Date(new Date().toGMTString())
|
|
|
|
module.exports = class Debug extends NonMemoryCachingBaseService {
|
|
static get category() {
|
|
return 'debug'
|
|
}
|
|
|
|
static get defaultBadgeData() {
|
|
return {
|
|
label: 'debug',
|
|
color: 'blue',
|
|
}
|
|
}
|
|
|
|
static get route() {
|
|
return {
|
|
base: 'debug',
|
|
pattern: ':which(time|starttime)',
|
|
}
|
|
}
|
|
|
|
async handle({ which }) {
|
|
switch (which) {
|
|
case 'time':
|
|
return {
|
|
label: 'time',
|
|
message: new Date().toUTCString(),
|
|
}
|
|
case 'starttime':
|
|
return {
|
|
label: 'start time',
|
|
message: new Date(serverStartTime).toUTCString(),
|
|
}
|
|
}
|
|
}
|
|
}
|