Skip to content

v2.1.0

Compare
Choose a tag to compare
@siddhsuresh siddhsuresh released this 14 Aug 14:07
· 9 commits to main since this release

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.