Skip to content

"all" not supported as Payload method type though in docs #14732

@cgilly2fast

Description

@cgilly2fast

Describe the Bug

The payload endpoint type definition notes being able to set an endpoint to "all"

but its not actually possible

Can "all" be added?

/**
 * Docs: https://payloadcms.com/docs/rest-api/overview#custom-endpoints
 */
export type Endpoint = {
  /** Extension point to add your custom data. */
  custom?: Record<string, any>

  /**
   * Middleware that will be called when the path/method matches
   *
   * Compatible with Web Request/Response Model
   */
  handler: PayloadHandler
  /** HTTP method (or "all") */
  method: 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put'
  /**
   * Pattern that should match the path of the incoming request
   *
   * Compatible with the Express router
   */
  path: string
  /**
   * Please add "root" routes under the /api folder in the Payload Project.
   * https://nextjs.org/docs/app/api-reference/file-conventions/route
   *
   * @deprecated in 3.0
   */
  root?: never
}

Link to the code that reproduces this issue

https://github.com/payloadcms/payload/blob/main/packages/payload/src/config/types.ts

Reproduction Steps

Create and endpoint, and attempt to use "all"

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

`3.64.0`

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions