@Auth()
app.get("/generate-password", {
handler: async(request: FastifyRequest, reply: FastifyReply) => {
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&()*,-./:;<>=?@[]^_~+";
let password = "";
for (let i = 0; i < 16; i++) {
password += characters.charAt(Math.floor(Math.random() * characters.length));
}
reply.send({ password });
}
});
Error: Parsing error: Declaration expected
Decorator:
export const Auth = (type?: string) => {
return async(request: FastifyRequest, reply: FastifyReply) => {
console.log(type);
};
};