22 lines
No EOL
563 B
TypeScript
22 lines
No EOL
563 B
TypeScript
import { channelSchema } from "$/schemas/general";
|
|
import { config, database } from "$/main";
|
|
import { ServerRoute } from "@hapi/hapi";
|
|
import Joi from "joi";
|
|
|
|
const route: ServerRoute = {
|
|
method: `GET`, path: `/{channel}/game`,
|
|
options: {
|
|
validate: {
|
|
params: Joi.object({
|
|
channel: channelSchema,
|
|
}),
|
|
},
|
|
},
|
|
async handler(request) {
|
|
const { channel } = request.params;
|
|
|
|
let { current, incorrect } = await database.getChannel(channel);
|
|
return `${current} (incorrect: ${incorrect}/${config.game.max_incorrect})`;;
|
|
},
|
|
};
|
|
export default route; |