Skip to content

Commit

Permalink
fix: support patch method auto-scanning (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Apr 26, 2022
1 parent 08f0423 commit 01801c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/runtime/virtual/server-handlers.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { CompatibilityEventHandler } from 'h3'
import type { CompatibilityEventHandler, RouterMethod } from 'h3'

interface HandlerDefinition {
route: string
lazy?: boolean
handler: CompatibilityEventHandler | (() => Promise<CompatibilityEventHandler>)
method?: 'connect'| 'delete'| 'get'| 'head'| 'options'| 'post'| 'put'| 'trace'
method?: RouterMethod
}

export const handlers: HandlerDefinition[]
2 changes: 1 addition & 1 deletion src/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { Nitro, NitroEventHandler } from './types'
export const GLOB_SCAN_PATTERN = '**/*.{ts,mjs,js,cjs}'
type FileInfo = { dir: string, path: string, fullPath: string }

const httpMethodRegex = /\.(connect|delete|get|head|options|post|put|trace)/
const httpMethodRegex = /\.(connect|delete|get|head|options|patch|post|put|trace)/

export async function scanHandlers (nitro: Nitro) {
const handlers = await Promise.all([
Expand Down

0 comments on commit 01801c2

Please sign in to comment.