-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Labels
Description
May be have decorator?
May be in the nest it differently?
Or where i can pass router schema data to fastify?
For example:
In Nest
@Post()
login() {
// get user bla bla bla
user = { password: 'changeme', username: 'admin' }
const { password, ..data } = user;
return data;
}response return { username: 'admin' }
in Fastify
fastify.route({ url: '/login', method: ["GET"],
schema: {
response: {
201: {
type: 'object',
properties: { username: {type: 'string' } }
}
},
handler: (req, resp) {
// get user bla bla bla
user = { password: 'changeme', username: 'admin' }
return resp.code(201).send(user);
}response return { username: 'admin' } without password according to the scheme
Sorry for google translate eng.
Reactions are currently unavailable