import type { ResponseFactory } from '@chubbyts/chubbyts-http-types/dist/message-factory';import type { Method, Response, ServerRequest } from '@chubbyts/chubbyts-http-types/dist/message';import type { Route } from '@chubbyts/chubbyts-framework/dist/router/route';import { createRoute } from '@chubbyts/chubbyts-framework/dist/router/route';const responseFactory: ResponseFactory = ...;const route: Route = createRoute({ method: Method.GET path: '/hello/:name([a-z]+)', name: 'hello', handler: async (request: ServerRequest): Promise<Response> => { const response = responseFactory(200); response.body.end(`Hello, ${request.attributes.name}`); return { ...response, headers: { ...response.headers, 'content-type': ['text/plain'] } }; },}); Copy
import type { ResponseFactory } from '@chubbyts/chubbyts-http-types/dist/message-factory';import type { Method, Response, ServerRequest } from '@chubbyts/chubbyts-http-types/dist/message';import type { Route } from '@chubbyts/chubbyts-framework/dist/router/route';import { createRoute } from '@chubbyts/chubbyts-framework/dist/router/route';const responseFactory: ResponseFactory = ...;const route: Route = createRoute({ method: Method.GET path: '/hello/:name([a-z]+)', name: 'hello', handler: async (request: ServerRequest): Promise<Response> => { const response = responseFactory(200); response.body.end(`Hello, ${request.attributes.name}`); return { ...response, headers: { ...response.headers, 'content-type': ['text/plain'] } }; },});