martenframework / marten

The pragmatic web framework.
https://martenframework.com
MIT License
425 stars 24 forks source link

Extract Marten::Server handlers into separate method #241

Closed ipepe closed 4 months ago

ipepe commented 4 months ago

Summary

This PR refactors the HTTP server initialization in Marten to facilitate its use in a serverless environment. By separating the server instance creation and the handler configuration, users can now easily access the handlers independently of the server instance.

Changes

Motivation

The primary motivation for this change is to support hosting Marten in a serverless environment. In such environments, only the handlers are required, not a full HTTP server instance. This refactoring allows for more flexible usage scenarios, including serverless setups.

Testing

This change is experimental and does not include comprehensive tests or examples. If there are specific use cases or scenarios that need to be covered, please let me know, and I will be happy to add them.

Additional Notes


Thank you for considering this PR. I look forward to your feedback and any suggestions to improve this implementation.