createNextRouteHandler
import { createNextRouteHandler } from "uploadthing/next";
import { ourFileRouter } from "./uploadthing.ts";
export const { GET, POST } = createNextRouteHandler({
router: ourFileRouter,
config: {
uploadthingId: "someId",
uploadthingSecret: "someSecret",
},
});
config
Object
This configuration is entirely optional, but may be useful if you would like to
programmatically set your UploadThing credentials. If you do not specify a
config
we will use the UPLOADTHING_SECRET
and UPLOADTHING_APP_ID
environment variables.
Key | Type | Required | Notes | Description |
---|---|---|---|---|
uploadthingId | string | No | The App ID for your uploadthing app | |
uploadthingSecret | string | No | The API key for your uploadthing app | |
callbackUrl | string | No | Custom callback URL to use instead of <BASE_URL>/api/uploadthing . |
Note: This same configuration object is also available for the
createNextPageApiHandler
function if you are using /pages
.