2.6.0 • Published 1 month ago

@mashroom/mashroom-cdn v2.6.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Mashroom CDN

Plugin for Mashroom Server, a Microfrontend Integration Platform.

This plugin adds a Service to manage CDN hosts. It basically just returns a host from a configurable list, which can be used to access an asset via CDN.

Usage

If node_modules/@mashroom is configured as plugin path just add @mashroom/mashroom-cdn as dependency.

After that you can use the service like this:

import type {MashroomCDNService} from '@mashroom/mashroom-cdn/type-definitions';

export default async (req: Request, res: Response) => {

    const cdnService: MashroomCDNService = req.pluginContext.services.cdn.service;

    const cdnHost = cdnService.getCDNHost();
    const resourceUrl = `${cdnHost}/<the-actual-path>`;

    // ..
};

You can override the default config in your Mashroom config file like this:

{
  "plugins": {
        "Mashroom CDN Services": {
            "cdnHosts": [
                "//cdn1.myhost.com",
                "//cdn2.myhost.com"
            ]
        }
    }
}
  • cdnHosts: A list of CDN hosts (default: [])

Services

MashroomCDNService

The CDN service is accessible through pluginContext.services.cdn.cacheControl

Interface:

export interface MashroomCDNService {
    /**
     * Return a CDN host or null if there is none configured.
     */
    getCDNHost(): string | null;
}
2.6.0

1 month ago

2.5.4

4 months ago

2.5.3

4 months ago

2.5.2

4 months ago

2.5.1

4 months ago

2.5.0

4 months ago

2.4.3

10 months ago

2.4.5

6 months ago

2.4.4

8 months ago

2.4.1

11 months ago

2.4.0

11 months ago

2.4.2

11 months ago

2.3.0

1 year ago

2.3.2

1 year ago

2.3.1

1 year ago

2.2.3

1 year ago

2.2.2

1 year ago

2.2.1

2 years ago

2.2.0

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.3

2 years ago

2.1.0

2 years ago

2.0.3

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.2

2 years ago

2.0.0-alpha.4

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

2.0.0-alpha.3

2 years ago

2.0.0-alpha.2

2 years ago

2.0.0-alpha.1

2 years ago

2.0.0-alpha.0

2 years ago