Added token authentication, organization module. Moved server bootstrapping code to server.ts file
This commit is contained in:
24
src/tokens/token.route.ts
Normal file
24
src/tokens/token.route.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
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
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user