Password Generator finished and working

This commit is contained in:
DomenikW 2025-02-19 16:15:27 +01:00
parent e348ea2aa9
commit 5930e8764d
5 changed files with 235 additions and 1 deletions

View file

@ -19,7 +19,7 @@ export async function colorConvert(app: FastifyInstance) {
return reply.status(400).send({ error: "No RGB declared!" });
}
const hex = (`#${(+data.red).toString(16).padStart(2, "0")}${(+data.green).toString(16).padStart(2, "0")}${(+data.blue).toString(16).padStart(2, "0")}`).toUpperCase();
reply.header("Content-Type", "application/json").send({ hex: hex });
reply.header("Content-Type", "text/plain").status(200).send(hex);
} catch (error) {
console.error("Convert error:", error);
reply.status(500).send({ error: "Error while converting!" });