Skip to content

Conversation

onelesd
Copy link
Contributor

@onelesd onelesd commented Oct 7, 2025

No description provided.

Copy link

vercel bot commented Oct 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
framework-docs Ready Ready Preview Comment Oct 9, 2025 9:11pm

@onelesd onelesd changed the title add express app to internal node server allow express app for consumption APIs in moose project Oct 7, 2025
@onelesd onelesd requested a review from Copilot October 7, 2025 23:00
Copy link
Contributor

@Copilot Copilot AI left a 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";

Comment on lines +291 to +299
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;
Copy link

Copilot AI Oct 7, 2025

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.

Suggested change
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant