github blitz-js/blitz v2.1.0

latest releases: v2.1.3, blitz@2.1.3, @blitzjs/rpc@2.1.3...
3 months ago

Releases

Minor Changes

  • 3b10b13: feat: add blitz auth support for the Web Request API standard

    Usage using the new withBlitzAuth adapter in the App Router:

    import {withBlitzAuth} from "app/blitz-server"
    
    export const {POST} = withBlitzAuth({
      POST: async (_request, _params, ctx) => {
        const session = ctx.session
        await session.$revoke()
    
        return new Response(
          JSON.stringify({
            userId: session.userId,
          }),
          {status: 200},
        )
      },
    })

    feat: New Blitz RPC handler meant to with the next.js app router route.ts files

    Usage using the new rpcAppHandler function

    // app/api/rpc/[[...blitz]]/route.ts
    import {rpcAppHandler} from "@blitzjs/rpc"
    import {withBlitzAuth} from "app/blitz-server"
    
    // Usage with blitz auth
    export const {GET, POST, HEAD} = withBlitzAuth(rpcAppHandler())
    
    // Standalone usage
    export const {GET, POST, HEAD} = rpcAppHandler()

    chore: Update the app directory starter

Patch Changes

  • d53da39: Improved parsing of default export names to handle higher-order components (HOCs) in the parseDefaultExportName function.

Don't miss a new blitz release

NewReleases is sending notifications on new releases.