How to extract a route into its own file in Fastify!

Поділитися
Вставка
  • Опубліковано 21 лис 2024

КОМЕНТАРІ • 11

  • @jboxy
    @jboxy Рік тому

    Fastify is awesome, fastify-plugin is a must. I like using an autoloader for hooks, plugins, and routes - in that order.

  • @naidusetti3831
    @naidusetti3831 Рік тому +2

    Interesting one Matteo, keep doing more short videos on fastify and platformatic db 🎉

  • @gabrielaltha
    @gabrielaltha Рік тому

    Hi Matteo, thanks for the explanation! So, what's the most difficult thing in Fastify for you?

  • @saramshshrestha7641
    @saramshshrestha7641 Рік тому

    Where do put your database calls in fastify, should I use decorates or split that into different file.

  • @jackdbd
    @jackdbd Рік тому

    The way Fastify registers plugin reminds me of how Hapi does it. But I can't quite understand why Fastify has both middlewares AND plugins...

    • @adventuresinnodeland
      @adventuresinnodeland  Рік тому +1

      It support middlewares for backward compatibility with the express ecosystem. They are implemented on top of plugins and hooks.

    • @jackdbd
      @jackdbd Рік тому

      Are Fastify hooks similar to Hapi request lifecycles? Would you recommend writing Fastify plugins + hooks and avoid middlewares if possible? I'm a big Hapi fan, but extending PlatformaticDB with Fastify plugins is kind of a big deal, so I'm seriously considering it.

    • @adventuresinnodeland
      @adventuresinnodeland  Рік тому

      @@jackdbd yes, they are the same of Hapi lifecycles

    • @jackdbd
      @jackdbd Рік тому

      @@adventuresinnodeland Awesome, thanks Matteo!