-
Lines 55 to 62 in f4a8f36 Why fastify doesn't stick to OOP concept by providing basic class for Route? Why don't you extend Other libraries like Hapi and ExpressJS provide their basic classes that can be extended and reused. I wish your API be more extensible. I also would like to override basic classes and provide them to Fastify so I don't use wrappers in controlling handlers: // app.js
class MyResponse extends fastify.Response { ... }
class MyRouter extends fastify.Router { ... }
fastify.context.Response = MyResponse
fastify.context.Router = MyRouter
... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Fastify uses factory functions to build new instances by extending the core prototypes with the provided options. This is a common OOP pattern, particularly in prototypal JavaScript. It is central to how Fastify provides the speed benefits it promises. |
Beta Was this translation helpful? Give feedback.
Thanks for letting us know your opinion. I’m glad that there are plenty of other frameworks to choose from. Hapi is great!