Skip to content

Commit

Permalink
Merge pull request #6 from EdamAme-x/jsdoc-for-mount
Browse files Browse the repository at this point in the history
Jsdoc for mount
  • Loading branch information
EdamAme-x authored May 30, 2024
2 parents 041229b + 1991877 commit c9e2364
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/hono-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,29 @@ class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string =
return this
}

/**
* `.mount()` allows you to mount applications built with other frameworks into your Hono application.
*
* @see {@link https://hono.dev/api/hono#mount}
*
* @param {string} path - base Path
* @param {Function} applicationHandler - other Request Handler
* @param {Function | undefined} optionHandler - other Request Handler with Hono Context
* @returns {Hono} mounted Hono instance
*
* @example
* ```ts
* import { Router as IttyRouter } from 'itty-router'
* import { Hono } from 'hono'
* // Create itty-router application
* const ittyRouter = IttyRouter()
* // GET /itty-router/hello
* ittyRouter.get('/hello', () => new Response('Hello from itty-router'))
*
* const app = new Hono()
* app.mount('/itty-router', ittyRouter.handle)
* ```
*/
mount(
path: string,
applicationHandler: (request: Request, ...args: any) => Response | Promise<Response>,
Expand Down

0 comments on commit c9e2364

Please sign in to comment.