diff --git a/examples/app/src/routes/users.ts b/examples/app/src/routes/users.ts index 2cdc6b9..6c7ef84 100644 --- a/examples/app/src/routes/users.ts +++ b/examples/app/src/routes/users.ts @@ -1,3 +1,4 @@ +import crypto from 'crypto' import type { FastifyInstance } from 'fastify' export async function userRoutes(fastify: FastifyInstance) { @@ -30,7 +31,7 @@ export async function userRoutes(fastify: FastifyInstance) { }, }, async (req, reply) => { const { name, email } = req.body as { name: string; email: string } - const id = `user-${Date.now()}` + const id = `user-${crypto.createHash('sha256').update(email).digest('hex').slice(0, 8)}` const user = { id, name, email } fastify.db.users.set(id, user) reply.status(201)