Dart Stream Developer
  • 👋Dartstream Framework
  • Prologue
    • Release Notes
      • Latest Release Notes
      • All Release Notes
    • Upgrade Guide
    • Contribution Guide
  • Getting Started
    • 😀Installation
    • ✨Our Features
      • Standard
        • CLI
        • Frontend Frameworks
        • Authentication
        • Cloud Storage
        • Database
        • Data Streaming
        • Feature Flags
        • Middleware
      • Enhanced
        • Email Management
        • Payment System Integration
        • Notifications
        • Localization and Internalization
        • Access Control and Security
        • Media Management
        • Search and Filtering
        • Audit Logging and Compliance
        • Analytics and Insights
    • 😀Directory Structure
    • 🦕Deployment
  • Product Guides
    • 📪Making a post
    • 📎Understanding Projects
    • 💡Video Guides
  • Documentation
    • 🛠️Fundamentals
      • 📝The Basics
        • Routing
        • Middleware
        • CSRF Protection
        • Controllers
        • Requests
        • Responses
        • Asset Bundling
        • URL Generation
        • Session
        • Validation
        • Error Handling
        • Logging
      • ℹ️Advanced
        • Broadcasting
        • Cache
        • Events
        • Feature Flags
        • File Storage
          • GCP
          • Amazon S3
          • Microsoft Blob Storage
        • Helpers
        • Http Client
        • Localization
        • Mail
        • Notifications
        • ORM
    • 📦Packages
      • 🧰Tools
      • 🍮Standard
      • 💸Enhanced
      • 💸Experimental
    • 😀SDKS
      • Firebase Admin SDK
      • Amazon Cognito SDK
      • Azure AD SDK
  • API Reference
  • Use Cases
    • 🎨For Designers
    • 🖥️For Developers
      • DartStream Extension Registration System
Powered by GitBook
On this page
  1. Getting Started
  2. Our Features
  3. Standard

Middleware

Middleware Capabilities

Middleware in DartStream plays a crucial role in managing and customizing the flow of HTTP requests and responses within server-side applications. Whether using the built-in solutions or crafting custom middleware, DartStream offers a comprehensive suite of middleware options to meet diverse project needs. Users can select from DS Middleware, DS Shelf, or custom middleware tailored to their specific requirements.

DS Middleware Feature Set

DS Middleware is DartStream’s built-in, comprehensive middleware solution, providing a wide range of features to streamline application development:

  • 404 Handling: Automatically manage not-found routes with customizable responses.

  • Authorization: Implement user authentication and authorization mechanisms.

  • Body Parsing: Simplify handling of incoming request bodies, including JSON and form data.

  • Cache: Built-in caching mechanisms for improved performance.

  • Collections: Manage data collections efficiently.

  • Compiling Assets: Preprocess and compile frontend assets.

  • Controllers: Organize and manage application logic through controllers.

  • Contracts: Define application contracts for maintainable code.

  • CORS: Enable Cross-Origin Resource Sharing with flexible configuration.

  • CSRF Protection: Prevent cross-site request forgery attacks.

  • Custom Type Handlers: Define handlers for custom data types.

  • Dependency Injection: Use dependency injection for better code modularity.

  • Dynamic Routes: Create routes dynamically based on runtime conditions.

  • Events: Manage application events and listeners.

  • File Downloads: Handle file download requests seamlessly.

  • File Storage: Integrated file storage solutions.

  • File System Routing: Automate routing based on file system structure.

  • File Uploads: Simplify file upload handling.

  • Helpers: Access utility functions for common tasks.

  • HTTP Client: Make external HTTP requests easily.

  • HTTP Helpers: Utility functions for HTTP-related tasks.

  • Index Routes: Automatically handle index routes.

  • Localization: Support for multi-language applications.

  • Logging: Built-in and third-party logging support for application insights.

  • Nested Routes: Create nested routes for complex applications.

  • Print Routes: Easily print out the list of registered routes.

  • Query String Variables: Parse and handle query strings in requests.

  • Requests and Responses: Manage and customize incoming requests and outgoing responses.

  • Robust Routing: Powerful routing system with extensive options.

  • Session Management: Manage user sessions efficiently.

  • Static File Support: Serve static files with ease.

  • URL Generation: Generate URLs dynamically based on route definitions.

  • Validation: Built-in validation for incoming data.

  • WebSocket Support: Enable real-time communication using WebSockets.

DS Shelf Middleware Feature Set

DS Shelf offers a more modular and minimalistic approach, providing essential middleware components that can be easily extended:

  • CORS Middleware: Handle cross-origin requests using shelf_cors_headers for flexible CORS management.

  • Request Logging: Log incoming requests with status codes and response times using shelf_logger.

  • Error Handling: Consistent error response formatting with custom or shelf_error_response implementations.

  • Request Body Parsing: Parse JSON or other structured data from request bodies, with custom implementations for JSON parsing.

  • Security Headers: Enhance security by adding headers like X-Content-Type-Options and Content-Security-Policy using shelf_secure_headers.

  • Static Asset Cache Control: Improve performance with cache control headers for static assets served by shelf_static.

Custom Middleware

For projects requiring specific middleware functionalities, Custom Middleware allows developers to:

  • Select and implement the necessary middleware features based on project requirements.

  • Create bespoke solutions for unique application needs, ensuring maximum flexibility and customization.

PreviousFeature FlagsNextEnhanced

Last updated 5 months ago

✨