-
Notifications
You must be signed in to change notification settings - Fork 19
allow express app for consumption APIs in moose project #2835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for Express applications in Moose projects as consumption APIs through a "Bring Your Own Framework" (BYOF) system. It allows developers to create Express apps alongside existing Moose APIs, with automatic detection, loading, and route collision handling.
Key changes:
- New BYOF system that automatically detects and loads Express apps with
createApp
functions - Framework adapter pattern supporting Express (with extensibility for other frameworks)
- Route collision detection between custom Express apps and existing Moose API instances
- New TypeScript Express template demonstrating the integration
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
templates/typescript-express/* | Complete new template showing Express integration with Moose, including models, transforms, views, workflows, and Express API |
packages/ts-moose-lib/src/consumption-apis/byof-*.ts | Core BYOF system implementation with app loading, framework adapters, and collision detection |
packages/ts-moose-lib/src/consumption-apis/runner.ts | Integration of BYOF system into existing API server with combined request handler |
packages/ts-moose-lib/src/consumption-apis/moose-logger.ts | Express middleware for consistent logging format |
packages/ts-moose-lib/src/index.ts | Export of moose logger for template usage |
Comments suppressed due to low confidence (1)
packages/ts-moose-lib/src/consumption-apis/byof-adapter.ts:1
- Similar to the previous comment, extensive use of
any
types reduces type safety. Consider using proper method signatures from Node.js HTTP types.
import type http from "http";
res.end = ((...args: any[]) => { | ||
responseSent = true; | ||
return (originalEnd as any)(...args); | ||
}) as any; | ||
|
||
res.writeHead = ((...args: any[]) => { | ||
responseSent = true; | ||
return (originalWriteHead as any)(...args); | ||
}) as any; |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of any
types reduces type safety. Consider using proper TypeScript method signatures for res.end
and res.writeHead
instead of casting to any
.
res.end = ((...args: any[]) => { | |
responseSent = true; | |
return (originalEnd as any)(...args); | |
}) as any; | |
res.writeHead = ((...args: any[]) => { | |
responseSent = true; | |
return (originalWriteHead as any)(...args); | |
}) as any; | |
res.end = function ( | |
this: typeof res, | |
...args: Parameters<typeof res.end> | |
): ReturnType<typeof res.end> { | |
responseSent = true; | |
return originalEnd(...args); | |
}; | |
res.writeHead = function ( | |
this: typeof res, | |
...args: Parameters<typeof res.writeHead> | |
): ReturnType<typeof res.writeHead> { | |
responseSent = true; | |
return originalWriteHead(...args); | |
}; |
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.