Skip to content

feat: Enable using something other than Express for a web server#1809

Open
joeyguerra wants to merge 2 commits intomainfrom
externalize-express
Open

feat: Enable using something other than Express for a web server#1809
joeyguerra wants to merge 2 commits intomainfrom
externalize-express

Conversation

@joeyguerra
Copy link
Copy Markdown
Member

Summary

I want to use a different web server - not Express. So I need a way for Hubot to load a different one.

  • Default to Express so it doesn't break anyone else
  • Implements an Express API for backwards compatibility
  • Defines a HttpServerPort to extend
  • To use, create a file that exports an asynchronous function that returns an instance of HttpServerPort. Checkout the ExpressHttpServerPort for reference.

Copilot AI review requested due to automatic review settings January 3, 2026 22:37
Copy link
Copy Markdown
Contributor

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 introduces a plugin architecture for HTTP servers in Hubot, allowing developers to use alternatives to Express. The implementation adds a base HttpServerPort class that defines the HTTP server interface, and refactors the existing Express integration into an ExpressHttpServerPort adapter.

Key changes:

  • Introduces HttpServerPort base class with stub implementations of HTTP server methods
  • Creates ExpressHttpServerPort as the default Express implementation
  • Refactors Robot constructor to accept a server factory function instead of a boolean
  • Adds CLI option --httpdserver to specify custom HTTP server modules

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
src/ports/HttpServerPort.mjs New base class defining the HTTP server port interface with stub methods
src/ports/ExpressHttpServerPort.mjs Express implementation of HttpServerPort with configuration via environment variables
src/Robot.mjs Refactored to use server factory pattern and converted setupExpress to static method
bin/Hubot.mjs Added CLI option and logic to load custom HTTP server modules
test/contracts/HttpServer_test.mjs New contract tests for HttpServerPort API
test/Robot_test.mjs Added test for non-Express HTTP server (with missing implementation)
test/Hubot_test.mjs Removed debug console.log statement

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ports/ExpressHttpServerPort.mjs Outdated
Comment thread test/Robot_test.mjs
Comment thread src/ports/ExpressHttpServerPort.mjs Outdated
Comment thread src/ports/ExpressHttpServerPort.mjs
Comment thread test/Robot_test.mjs Outdated
Comment thread src/ports/HttpServerPort.mjs Outdated
Comment thread src/Robot.mjs
Comment thread src/ports/ExpressHttpServerPort.mjs Outdated
Comment thread src/ports/ExpressHttpServerPort.mjs
Comment thread test/contracts/HttpServer_test.mjs
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.

2 participants