Conversation
Co-authored-by: bufferings+cursor <bufferings+cursor@gmail.com>
Co-authored-by: bufferings+cursor <bufferings+cursor@gmail.com>
Co-authored-by: bufferings+cursor <bufferings+cursor@gmail.com>
Co-authored-by: bufferings+cursor <bufferings+cursor@gmail.com>
Co-authored-by: bufferings+cursor <bufferings+cursor@gmail.com>
Co-authored-by: bufferings+cursor <bufferings+cursor@gmail.com>
Co-authored-by: bufferings+cursor <bufferings+cursor@gmail.com>
Co-authored-by: bufferings+cursor <bufferings+cursor@gmail.com>
Co-authored-by: bufferings+cursor <bufferings+cursor@gmail.com>
Co-authored-by: bufferings+cursor <bufferings+cursor@gmail.com>
Co-authored-by: bufferings+cursor <bufferings+cursor@gmail.com>
Co-authored-by: bufferings+cursor <bufferings+cursor@gmail.com>
Co-authored-by: bufferings+cursor <bufferings+cursor@gmail.com>
There was a problem hiding this comment.
Pull Request Overview
This pull request refactors the Kori example files to eliminate duplicated logic by introducing a uniform configure function pattern. Key changes include updating tsconfig paths and compiler options, refactoring each example file to export a configure function, and mounting these examples in index.ts for improved reusability and type safety.
Reviewed Changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/kori-example/tsconfig.json | Updated compiler options with new paths and type settings. |
| packages/kori-example/src/index.ts | Refactored landing page and mounted examples via configure. |
| packages/kori-example/src/09-openapi.ts | Converted to export a configure function instead of a standalone app. |
| packages/kori-example/src/08-error-handling.ts | Refactored error handling to export a configure function. |
| packages/kori-example/src/07-logging.ts | Updated logging endpoints with consistent type annotations. |
| packages/kori-example/src/06-child-instances.ts | Added type support and standardized configure function export. |
| packages/kori-example/src/05-plugin-system.ts | Refactored plugin system and integrated custom plugin demo. |
| packages/kori-example/src/04-lifecycle-hooks.ts | Updated lifecycle hooks with explicit types and a configure export. |
| packages/kori-example/src/03-validation.ts | Standardized validation routes with type annotations. |
| packages/kori-example/src/02-basic-routing.ts | Refactored basic routing to export a configure function. |
| packages/kori-example/src/01-getting-started.ts | Enhanced the getting started example with schema validation and logging. |
| package.json | Updated dependency versions and dev dependency configuration. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
| const requestKey = `${ctx.req.method}-${ctx.req.url.pathname}`; | ||
|
|
||
| for (const [key, value] of requestTimings.entries()) { | ||
| if (key.startsWith(requestKey)) { | ||
| const duration = endTime - value.startTime; | ||
| ctx.req.log.info('Request completed', { | ||
| requestNumber: value.requestNumber, | ||
| duration, | ||
| category: duration < 100 ? 'fast' : duration < 500 ? 'medium' : 'slow', | ||
| }); | ||
| requestTimings.delete(key); | ||
| break; | ||
| } |
There was a problem hiding this comment.
[nitpick] Consider storing the request key (or unique request identifier) in the request context during onRequest to simplify the lookup during onResponse, instead of iterating through all map entries.
There was a problem hiding this comment.
Bug: Incorrect Plugin Route Prefixing
The custom plugin route is incorrectly accessible at /custom/custom instead of /custom. This is because the createChild method sets a /custom prefix, while the route within the child is also defined at /custom. The route path within the child should be / to correctly expose the endpoint at /custom.
packages/kori-example/src/05-plugin-system.ts#L296-L306
kori/packages/kori-example/src/05-plugin-system.ts
Lines 296 to 306 in 10d6400
BugBot free trial expires on July 22, 2025
You have used $0.00 of your $50.00 spend limit so far. Manage your spend limit in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
Refactor Kori example files to use a
configurefunction pattern and mount them inindex.tsto eliminate code duplication and improve reusability.The original setup had individual example files that were not used by
index.ts, leading to duplicated logic. This PR converts each example into a reusableconfigurefunction, which is then imported and mounted as a child application inindex.ts. This also involved updating type declarations and module resolution to ensure a clean, type-safe build.