0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-24 11:07:29 +01:00

docs(powered-by): add JSDoc (#3520)

This commit is contained in:
Yusuke Wada 2024-10-15 17:50:12 +09:00 committed by GitHub
parent 89a0ac18ed
commit 90833d2467
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,9 +5,28 @@
import type { MiddlewareHandler } from '../../types'
type PoweredByOptions = {
/**
* The value for X-Powered-By header.
* @default Hono
*/
serverName?: string
}
/**
* Powered By Middleware for Hono.
*
* @param options - The options for the Powered By Middleware.
* @returns {MiddlewareHandler} The middleware handler function.
*
* @example
* ```ts
* import { poweredBy } from 'hono/powered-by'
*
* const app = new Hono()
*
* app.use(poweredBy()) // With options: poweredBy({ serverName: "My Server" })
* ```
*/
export const poweredBy = (options?: PoweredByOptions): MiddlewareHandler => {
return async function poweredBy(c, next) {
await next()