GenHTTP

repository·main·Indexed 42 days ago

https://github.com/kaliumhexacyanoferrat/genhttp

A lightweight, modular web server written in pure C# for .NET 10/11. It features built-in support for OpenAPI, graphical API viewers (Swagger UI, Redoc, Scaler), and a modular architecture with packages for authentication, compression, dependency injection, and I/O. It supports multiple server engines including Kestrel and Ioxide, and can be integrated into ASP.NET Core applications via the GenHTTP.Adapters.AspNetCore package.

Tokens
9.8K
Snippets
20
Records
57
Agent score
53%

What's inside GenHTTP

  1. Overview of GenHTTP.Modules.Reflection

    main
    The GenHTTP.Modules.Reflection package provides core functionality used across all GenHTTP webservice frameworks. Its primary purpose is to enable the analysis and dynamic invocation of methods provided by applications. This allows GenHTTP to bridge the gap between static application code and dynamic web service interfaces by inspecting and calling methods at runtime.
  2. Use GenHTTP.Modules.Authentication for authentication methods

    main

    The GenHTTP.Modules.Authentication package provides implementations for various authentication methods that can be integrated into GenHTTP applications.

    Supported authentication methods include:

    • API key
    • Basic
    • Bearer
    • Client

    For advanced implementations such as role-based authentication, refer to the official GenHTTP documentation.

  3. Use Virtual Hosting to serve content based on the Host header

    main

    The GenHTTP.Modules.VirtualHosting package enables a web server to serve different content or route requests to different handlers based on the value of the Host header provided in the client's HTTP request. This is useful for hosting multiple domains or subdomains on a single server instance.

    For detailed implementation guides and specific usage examples, refer to the official GenHTTP documentation for virtual hosts.

  4. Host a websocket endpoint with GenHTTP.Modules.Websockets

    main
    The GenHTTP.Modules.Websockets package enables you to host websocket endpoints within a GenHTTP application. This allows for real-time, bidirectional communication between the server and clients. For detailed implementation guides and specific usage patterns, refer to the official GenHTTP documentation.
  5. Use GenHTTP.Modules.ErrorHandling to define custom error handlers

    main
    The GenHTTP.Modules.ErrorHandling package provides the capability to define and register custom error handlers within a GenHTTP application. This allows you to intercept errors occurring during request processing and return specific responses or perform custom logic (such as logging or telemetry) instead of the default error behavior.
  6. Use GenHTTP.Modules.Security for web security concerns

    main

    The GenHTTP.Modules.Security package provides implementations for common web security concerns. You can use this module to protect your GenHTTP server by implementing features such as:

    • Cors: Configure Cross-Origin Resource Sharing policies.
    • StrictTransport: Implement HTTP Strict Transport Security (HSTS).
    • SnifferPrevention: Prevent MIME type sniffing.
    • SecureUpgrade: Handle secure protocol upgrades.
  7. Use GenHTTP.Modules.Webservices to provide REST webservices

    main

    The GenHTTP.Modules.Webservices package enables you to expose RESTful web services from within a GenHTTP application. This allows you to integrate standard web service capabilities into your GenHTTP server architecture.

    For detailed implementation guides, advanced configuration, and specific API usage, refer to the official GenHTTP documentation.

  8. Use GenHTTP.Modules.ReverseProxy to proxy requests

    main
    The GenHTTP.Modules.ReverseProxy package enables a GenHTTP server to act as a reverse proxy. It fetches responses from an upstream server based on incoming HTTP requests and passes those responses back to the requesting client. This is useful for routing traffic to other services or masking upstream server identities.
  9. Use GenHTTP.Modules.DirectoryBrowsing to list directories

    main
    The GenHTTP.Modules.DirectoryBrowsing package provides functionality to generate simple directory listings from an existing IResourceTree. This allows users to browse the contents of a resource tree through a web interface. For detailed implementation samples and advanced configuration, refer to the official GenHTTP documentation on listing handlers.
  10. Configure best practices for web service development with GenHTTP.Modules.Practices

    main

    The GenHTTP.Modules.Practices package provides tools to configure an IServerHost with industry-standard best practices. Using this module helps automate the implementation of common web service concerns such as:

    • Compression: Automatically compressing responses to reduce payload size.
    • eTag handling: Implementing entity tags for efficient cache validation.
    • Security hardening: Applying standard security configurations to protect the web service.

    For detailed implementation guides and specific configuration options, refer to the official GenHTTP documentation on defaults.