JSPM

  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q112322F
  • License MIT

Mongo/GridFS backend for the travetto asset module

Package Exports

  • @travetto/asset-mongo

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@travetto/asset-mongo) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

travetto: Asset-Mongo

Install: mongo provider

$ npm install @travetto/asset-mongo

This provides a mongodb implementation of the AssetSource which is a backend for the Asset module.

Code: Mongo backend wiring

class AppConfig {
  @InjectableFactory()
  static getSource(cfg: AssetMongoConfig): AssetSource {
    return new AssetMongoSource(cfg);
  }
}

There is a default configuration that you can easily use, with some sensible defaults.

Code: Mongo configuration

@Config('asset.mongo')
export class AssetMongoConfig {
  hosts = 'localhost';
  schema = 'app';
  port = 27017;
  options = {};
  ...
}

Additionally, you can see that the class is registered with the @Config annotation, and so these values can be overridden using the standardConfiguration resolution paths.