feat: create token validation endpoint

This commit is contained in:
2026-01-20 11:27:52 +07:00
parent 22428c720c
commit 20b371dbf6
3 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,21 @@
import { Context } from "elysia";
import { tokenValidationService } from "../services/http/tokenValidation.service";
import { returnReadResponse } from "../../../helpers/callback/httpResponse";
import { mainErrorHandler } from "../../../helpers/error/handler";
export const tokenValidationController = (
ctx: Context & { body: { token: string } },
) => {
try {
const { token } = ctx.body;
const validationResult = tokenValidationService(token);
return returnReadResponse(
ctx.set,
200,
"Validation successful",
validationResult,
);
} catch (error) {
return mainErrorHandler(ctx.set, error);
}
};