Repository navigation
feat: Introduce Relic web sever - #3
Merged
Merged
Conversation
klkucaj
force-pushed
the
copy-relic-from-serverpod-repo
branch
from
December 13, 2024 14:14
22da813 to
26f38ba
Compare
5 of 8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces Relic, a lightweight and strictly typed HTTP server.
Inspired by Shelf, Relic focuses on type safety, performance, and modularity while maintaining extensibility.
Key Features
Core Library (
lib/)relic.dart:lib/src/:This directory organizes the core logic into specialized modules to ensure clarity, scalability, and maintainability.
Core Server Files:
relic_server.dart: Implements the primary server functionality backed by Dart'sHttpServer, handling connections, routing, and core features.relic_server_serve.dart: Provides functionality for serving HTTP requests, with support for advanced features like request hijacking.Modules:
handler/: Implements mechanisms for flexible request routing, delegation, and pipelines for chaining handlers.middleware/: Contains utilities to integrate middleware, including extensions and logging functionality for monitoring requests and responses.logger/: Provides structured logging for better observability and debugging.util/: Shared utility functions for common operations within the library.body/: Handles parsing, validation, and type-checking of request/response bodies.message/: Manages HTTP message formatting, includingrequest.dartandresponse.dartfor processing requests and responses.headers/:The headers module is a central component of the Relic library, offering robust functionality for handling HTTP headers:
headers.dart: Provides the main abstraction for managing HTTP headers, integrating with various submodules.extension/: Adds utility methods for working with headers represented as strings, enabling ease of use and flexibility.parser/: Includesheaders_parser.dartandcommon_types_parser.dartto convert raw headers into structured, validated formats.typed/: Offers predefined and user-defined typed headers, improving reliability and ensuring correctness.custom/: Allows for the definition and management of application-specific headers.exception/: Defines error types for invalid or improperly formatted headers, ensuring reliability.static/: Implements the logic for serving static files, including custom directory listings and optimizations for asset handling.hijack/: Provides request hijacking for advanced use cases requiring low-level control.method/: Manages and validates HTTP methods, ensuring adherence to standard protocols.Test Suite (
test/)The
test/directory includes a comprehensive set of unit and integration tests that validate Relic's features and reliability.Core Test Files:
relic_server_test.dart: Tests the primary server's functionality, including routing and connection handling.relic_server_serve_test.dart: Focuses on validating the server'sservelogic and advanced features like request hijacking.Subdirectories:
handler/: Verifies the routing, delegation, and pipeline mechanisms.middleware/: Tests middleware integration, extensions, and logging functionality.util/: Tests utility functions for correctness and performance.message/: Focuses on request and response message formatting and parsing.headers/:headers/module, including:static/: Ensures proper handling of static file serving and directory listings.hijack/: Tests advanced request hijacking logic for robustness.Related: #2008
This PR was first opened as serverpod/serverpod#2744 in the Serverpod repository. It was later decided to move the project into its own standalone repository, resulting in the creation of this PR.