0
0
Fork 0
Chatman/src/endpoints/setup_channel.ts
2023-02-20 19:57:37 -07:00

21 lines
No EOL
460 B
TypeScript

import { channelSchema } from "$/schemas/general";
import { ServerRoute } from "@hapi/hapi";
import { database } from "$/main";
import Joi from "joi";
const route: ServerRoute = {
method: `POST`, path: `/channels`,
options: {
validate: {
payload: Joi.object({
channel: channelSchema,
}),
},
},
async handler(request, h) {
// @ts-ignore
await database.createChannel(request.payload.channel);
return h.close;
},
};
export default route;