Last active
August 31, 2023 20:15
-
-
Save KirillTregubov/d9c5434a6112a2daa3e11dc5f582a338 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.post<{ | |
Body: { | |
userId: string | |
} | |
// More keys: https://fastify.dev/docs/latest/Reference/TypeScript/#using-generics (3rd step) | |
}>( | |
'/my-endpoint', | |
async ({ body }, reply) { | |
console.log(body) // <- is of correct type | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment