From d936a65c283cbd28f5c5779e0e4c562df4a8f81e Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Thu, 3 Aug 2023 23:41:26 +0200 Subject: [PATCH] Created the validate.ts routes --- src/routes/v1/validate.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/routes/v1/validate.ts diff --git a/src/routes/v1/validate.ts b/src/routes/v1/validate.ts new file mode 100644 index 0000000..ce0c874 --- /dev/null +++ b/src/routes/v1/validate.ts @@ -0,0 +1,13 @@ +import { Request, Response, Router } from "express"; +import { validateLicense } from "@controller/validation"; + +const app: Router = Router(); + +app.get("/:licenseKey", async (req: Request, res: Response) => { + const validationKey = req.header("X-Validation-Key"); + if (!validationKey) return res.status(400).json({ code: 1, message: "You need to provide a validation key" }); + + res.json(await validateLicense(validationKey, req.params.licenseKey)); +}); + +export default app; \ No newline at end of file