You can load up any kind of Thorin component, by calling the appropriate registration function.
thorin.Interface.Transport
,
or the full name of the transport and Thorin will try to perform
require(transport)
.
thorin.Interface.Store
or the full name of the store module, as Thorin will try to perform require(store)
.
opt
object will override any application-level configuration for the plugin.
require(name)
. If a function, it will be called with fn(thorin, opt, name)
thorin.Interface.Sanitizer
addLibrary(module)
with no name and module as an object or constructor function, the name of the library will
be taken from module.namethorin.addLibrary(module=string)
// it will perform require(module);thorin.addLibrary(module=function, name=string)
// use the constructor function with a specific namethorin.addLibrary(module=string, name=string)
// it will perform require(module) and register the library with the given namethorin.addLibrary(module=function)
// it will register the the library using the module's prototype.name or module.name
'use strict';
const thorin = require('thorin');
thorin.addTransport(require('thorin-transport-http'))
.addStore(require('thorin-store-redis'), 'sessionDb', 'cacheDb')
.addPlugin(require('thorin-plugin-less'), {
watch: true
})
.addLibrary('app/lib/myLib.js', 'myLib');
thorin.run();
You can always create a new issue on GitHub or contact one of the core founders by chat.