CLERK_API_KEYvale from your environment **** variables. If your application is using .env files, create a file named .env.local in your application root if it doesn't exist already and add the above variable.
ClerkExpressWithSessionmiddleware will set the Clerk session on the request object as
req.sessionand then call the next middleware.
Clerkinstance, you can use:
clerkis your own instance.
optionsobject as an optional argument. The only key currently supported is
onErrorfor providing your own error handler.
onErrorfunction, if provided, should take an
Erroris returned, the middleware will call
next(err)with that error. If the
statusCodeit will indicate to Express what HTTP code the response should have.
Erroris returned (or nothing is returned at all), then the middleware will call
defaultOnErroris used in the lax middleware variant and
strictOnErrorin the strict variant.
onErroroption mentioned above, Express comes with a default error handler for errors encountered in the middleware chain.
errpass to your error handler will contain enough context for you to respond as you deem fit.