0
0
Fork 0

Add a method to view the game's current state without affecting it.

This commit is contained in:
Oliver-Akins 2023-02-19 20:45:58 -07:00
parent 444010e206
commit a5dd1aac4e

View file

@ -0,0 +1,21 @@
import { ServerRoute } from "@hapi/hapi";
import { database } from "$/main";
import Joi from "joi";
const route: ServerRoute = {
method: `GET`, path: `/{channel}/game`,
options: {
validate: {
params: Joi.object({
channel: Joi.string().alphanum(),
}),
},
},
async handler(request) {
const { channel } = request.params;
let { current, incorrect } = await database.getChannel(channel);
return { current, incorrect };
},
};
export default route;