@chubbyts/chubbyts-framework
    Preparing search index...

    Function createRoute

    • import type { Response, ServerRequest } from '@chubbyts/chubbyts-undici-server/dist/server';
      import type { Route } from '@chubbyts/chubbyts-framework/dist/router/route';
      import { createRoute } from '@chubbyts/chubbyts-framework/dist/router/route';

      const route: Route = createRoute({
      method: 'GET'
      path: '/hello/:name([a-z]+)',
      name: 'hello',
      handler: async (serverRequest: ServerRequest): Promise<Response> => {
      return new Response(`Hello, ${serverRequest.attributes.get('name')}`, {
      status: 200,
      statusText: 'OK',
      headers: { 'content-type': 'text/plain' },
      });
      },
      });

      Parameters

      Returns Route