Middleware Explained

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

КОМЕНТАРІ • 21

  • @prashlovessamosa
    @prashlovessamosa 5 місяців тому +3

    Please never stop making awesome videos.
    It's super refreshing to hear both of you.

  • @L.A.Frazier
    @L.A.Frazier 5 місяців тому +4

    WES BOS. THE MOISTMAKER.

  • @2breezy866
    @2breezy866 5 місяців тому

    You can actually write middleware outside of the middleware.ts file in Next.js. It’s not as pretty as connect-style middleware, but it is possible. In app router, you simple create a higher-order function that either returns a response or calls the route handler, which is passed in as a parameter.

  • @erikslorenz
    @erikslorenz 5 місяців тому

    I think middleware in general is one of the coolest things in web dev

  • @charliesta.abc123
    @charliesta.abc123 5 місяців тому

    In next.js you can split your middleware into file/ function that export function that take NextMiddleware and return NextMiddleware

  • @SheeceGardazi
    @SheeceGardazi 5 місяців тому +3

    No, no, no authentication in layout while using sveltekit ... It becomes stale upon navigation. Use individual page load functions to check authentication.
    The Problem with Using Layouts for Auth ua-cam.com/video/UbhhJWV3bmI/v-deo.html
    Protect SvelteKit Routes with Hooks ua-cam.com/video/K1Tya6ovVOI/v-deo.html

    • @syntaxfm
      @syntaxfm  5 місяців тому +1

      We said put it in middleware (hooks.sever.ts)

    • @Kawiatube
      @Kawiatube 5 місяців тому

      I do all three; hooks(populate user), layout(make sure, for layouts that require user), load function(to shut typescript up)

    • @SheeceGardazi
      @SheeceGardazi 5 місяців тому

      @@Kawiatube The Problem with Using Layouts for Auth ua-cam.com/video/UbhhJWV3bmI/v-deo.html

    • @SheeceGardazi
      @SheeceGardazi 5 місяців тому

      @@Kawiatube The Problem with Using Layouts for Auth ua-cam.com/video/UbhhJWV3bmI/v-deo.html

    • @SheeceGardazi
      @SheeceGardazi 5 місяців тому

      @@Kawiatube i dont know why i cant share video from hunterbyte ... search for The Problem with Using Layouts for Auth

  • @alexdeathway
    @alexdeathway 5 місяців тому +1

    More videos discussing concept like this.

    • @WesBos
      @WesBos 5 місяців тому

      coming up! LMK if you have any requests!

    • @alexdeathway
      @alexdeathway 5 місяців тому

      @@WesBos Nothing in particular, just the way you explained the concept and dropped some examples of implementation was quite intriguing, so a topic related to backend would be more than welcome also subscribed you.

  • @rrd_webmania
    @rrd_webmania 5 місяців тому

    Nuxt middleware are really flexible both server and client side

  • @intensedev
    @intensedev 5 місяців тому

    Initialize a database connection in a middleware is definitely not a good idea, that would really increase the time between each fetch-request cycle

    • @syntaxfm
      @syntaxfm  5 місяців тому +2

      In a server less context, where else would you initialize the connection, given that there is no long running process?

  • @AkinBelieve
    @AkinBelieve 5 місяців тому

    On the topic of moist-makers. I hear Americans don't put butter in their sandwiches... that's wild.

    • @syntaxfm
      @syntaxfm  5 місяців тому

      We don’t. 🇺🇸

  • @kelsey_roy
    @kelsey_roy 5 місяців тому

    Middleware = interceptor