Это видео недоступно.
Сожалеем об этом.

Middleware Explained

Поделиться
HTML-код
  • Опубликовано: 15 авг 2024
  • Join Wes and Scott for a hasty episode of Syntax as they unpack the power of middleware for developers, covering caching, authentication, A/B testing, error handling, and user redirection in a quick, punchy rundown to supercharge your backend skills!
    Show Notes
    00:00 Welcome to Syntax!
    00:41 Syntax on RUclips.
    01:28 What is middleware?
    05:04 Some real-world examples of middleware.
    05:10 Authentication.
    07:44 Redirecting users to a specific instance.
    08:28 Logging + statistics.
    09:41 Debugging.
    10:00 Timers.
    10:46 A/B testing.
    11:59 Error handling + logging.
    12:23 Caching.
    13:02 Multi-tenant applications.
    15:08 Where does it run?
    18:07 What are the limitations?
    21:52 Next.js middleware is one file only.
    23:35 Sveltekit solution.
    24:31 Connect style.
    25:28 One last thing, NPM Installing.
    All links available at syntax.fm/747
    ------------------------------------------------------------------------------
    Hit us up on Socials!
    Scott: / stolinski
    Wes: / wesbos
    Randy: / @randyrektor
    Syntax: / syntaxfm
    www.syntax.fm
    Brought to you by Sentry.io
    #webdevelopment #webdeveloper #javascript

Комментарии • 21

  • @prashlovessamosa
    @prashlovessamosa 4 месяца назад +3

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

  • @L.A.Frazier
    @L.A.Frazier 4 месяца назад +4

    WES BOS. THE MOISTMAKER.

  • @erikslorenz
    @erikslorenz 4 месяца назад

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

  • @2breezy866
    @2breezy866 4 месяца назад

    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.

  • @rrd_webmania
    @rrd_webmania 4 месяца назад

    Nuxt middleware are really flexible both server and client side

  • @charliesta.abc123
    @charliesta.abc123 4 месяца назад

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

  • @SheeceGardazi
    @SheeceGardazi 4 месяца назад +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 ruclips.net/video/UbhhJWV3bmI/видео.html
    Protect SvelteKit Routes with Hooks ruclips.net/video/K1Tya6ovVOI/видео.html

    • @syntaxfm
      @syntaxfm  4 месяца назад +1

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

    • @Kawiatube
      @Kawiatube 4 месяца назад

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

    • @SheeceGardazi
      @SheeceGardazi 4 месяца назад

      @@Kawiatube The Problem with Using Layouts for Auth ruclips.net/video/UbhhJWV3bmI/видео.html

    • @SheeceGardazi
      @SheeceGardazi 4 месяца назад

      @@Kawiatube The Problem with Using Layouts for Auth ruclips.net/video/UbhhJWV3bmI/видео.html

    • @SheeceGardazi
      @SheeceGardazi 4 месяца назад

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

  • @alexdeathway
    @alexdeathway 4 месяца назад +1

    More videos discussing concept like this.

    • @WesBos
      @WesBos 4 месяца назад

      coming up! LMK if you have any requests!

    • @alexdeathway
      @alexdeathway 4 месяца назад

      @@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.

  • @AkinBelieve
    @AkinBelieve 4 месяца назад

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

    • @syntaxfm
      @syntaxfm  4 месяца назад

      We don’t. 🇺🇸

  • @intensedev
    @intensedev 4 месяца назад

    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  4 месяца назад +2

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

  • @kelsey_roy
    @kelsey_roy 4 месяца назад

    Middleware = interceptor