@gullerya/just-test
Version:
JavaScript multiplatform tests runner
17 lines (15 loc) • 424 B
JavaScript
const basePathValidator = /^[a-z-_]+$/;
export class RequestHandlerBase {
constructor() {
const bp = this.basePath;
if (!bp || typeof bp !== 'string' || !basePathValidator.test(bp)) {
throw new Error(`extending handler MUST provide basePath as a string matching '${basePathValidator}'`);
}
}
get basePath() {
return null;
}
async handle() {
throw new Error('implementation missing');
}
}