The term “url” is overloaded in services, to refer to the Shields route and also the API URL. Calling the Shields URL a “route” is on the whole more descriptive, and makes it clearer and more obvious which one of these we’re talking about. It’s a small thing, though seems like an improvement. We have a few functions called `buildUrl`. I’ve renamed them to `buildRoute` when they refer to routes, and left them as `buildUrl` when they refer to API URLs. I included a minor style tweak and some formatting cleanup in `TUTORIAL.md`.
29 lines
420 B
JavaScript
29 lines
420 B
JavaScript
'use strict'
|
|
|
|
const BaseService = require('../base')
|
|
|
|
module.exports = class Time extends BaseService {
|
|
async handle() {
|
|
return { message: new Date() }
|
|
}
|
|
|
|
// Metadata
|
|
static get defaultBadgeData() {
|
|
return {
|
|
label: 'time',
|
|
color: 'blue',
|
|
}
|
|
}
|
|
|
|
static get category() {
|
|
return 'debug'
|
|
}
|
|
|
|
static get route() {
|
|
return {
|
|
base: 'servertime',
|
|
pattern: '',
|
|
}
|
|
}
|
|
}
|