github remix-run/remix fetch-router@0.4.0
fetch-router v0.4.0

13 hours ago
  • BREAKING CHANGE: Remove "middleware as an optional 2nd arg" from all router methods and introduced support for defining middleware inline in route handler definitions. This greatly reduces the number of overloads required in the router API and also provides a means whereby middleware may be coupled to request handler definitions

    // before
    router.map('/', [middleware], () => {
      return new Response('Home')
    })
    
    // after
    router.map('/', {
      use: [middleware],
      handler(ctx) {
        return new Response('Home')
      },
    })
  • Add routeNames option to createResource and createResources for customizing the names of the resource routes. This is a map of the default route name to a custom name.

    let books = createResources('books', {
      routeNames: { index: 'list', show: 'view' },
    })
    
    books.list // Route<'GET', '/books'>
    books.view // Route<'GET', '/books/:id'>
  • Add route shorthand for createRoutes to public exports

  • Add support for any BodyInit in html(body) response helper

  • Add createFormAction (also exported as formAction for short) for creating route maps with index (GET) and action (POST) routes. This is well-suited to showing a standard HTML <form> and handling its submit action at the same URL.

  • Export RouteHandlers and RouteHandler types

Don't miss a new remix release

NewReleases is sending notifications on new releases.