22 lines
490 B
TypeScript
22 lines
490 B
TypeScript
import { FastifyInstance } from 'fastify';
|
|
import { FromSchema } from 'json-schema-to-ts';
|
|
import { nanoid } from 'nanoid/async';
|
|
|
|
const schema = {
|
|
body: {
|
|
type: 'object',
|
|
required: ['session', 'key'],
|
|
properties: {
|
|
session: { type: 'string' },
|
|
key: { type: 'string' }
|
|
}
|
|
}
|
|
} as const;
|
|
|
|
export default async (server: FastifyInstance) =>
|
|
server.post<{ Body: FromSchema<typeof schema.body> }>(
|
|
'/create',
|
|
{ schema },
|
|
async (req, reply) => {}
|
|
);
|