jimpex
    Preparing search index...

    Class StaticsController

    The controller class that allows the application to serve specific files from any folder to any route without the need of mounting directories as "static".

    Index

    Constructors

    Properties

    _mime: Mime

    The MIME type library. Since it's an ESM only module, Jimpex loads it on boot and makes it available on the container.

    The controller customization options.

    _sendFile: SendFile

    The service that serves static files.

    files: Record<string, StaticsControllerFile>

    A dictionary with the formatted definitions of the files that will be served. It uses the files' routes as keys, for easy access in the middleware.

    Accessors

    Methods

    • Mounts the middlewares in the router in order to serve the files.

      Parameters

      • router: Router

        A reference to the application router.

      • middlewares: ExpressMiddleware[] = []

        A list of extra middlewares to execute before the file middleware.

      Returns Router