Files
permit-api/src/tokens/token.route.ts

25 lines
558 B
TypeScript

import { FastifyInstance } from "fastify";
import { createTokenHandler, getTokenHandler } from "./token.controller";
import { $token } from "./token.schema";
export async function tokenRoutes(fastify: FastifyInstance) {
fastify.post(
"/",
{
schema: {
body: $token("createTokenInput"),
response: {
201: $token("createTokenResponse"),
},
},
},
createTokenHandler
);
fastify.get(
"/:tokenId",
{ schema: { response: { 200: $token("getTokenResponse") } } },
getTokenHandler
);
}