本文整理汇总了TypeScript中inversify.Kernel.load方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Kernel.load方法的具体用法?TypeScript Kernel.load怎么用?TypeScript Kernel.load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inversify.Kernel
的用法示例。
在下文中一共展示了Kernel.load方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: require
/// <reference path="../../node_modules/inversify-dts/inversify/inversify.d.ts" />
import { Kernel, interfaces } from "inversify"
import * as Mod1 from './mod1/inversify'
const mod1_schema: JSON = require('./overrides/mod1_schema.json')
const default_kernel = new Kernel()
default_kernel.load(Mod1.kernel_module)
const kernel = new Kernel()
kernel.parent = default_kernel
kernel
.bind<Mod1.Schema>(Mod1.TYPES.Schema)
.toConstantValue(mod1_schema as Mod1.Schema)
kernel
.bind<Mod1.StaticData>(Mod1.TYPES.StaticData)
.toConstantValue([ { name: 'OV Mod1 foo'}] as Mod1.StaticData)
export default kernel
示例2: Kernel
import { Kernel } from 'inversify';
import * as morgan from 'morgan';
import * as bodyParser from 'body-parser';
import * as cors from 'cors';
import * as jwt from 'express-jwt';
import { commands, controllers, infra, queries } from './bootstrap';
import { config } from './config';
import { DonorsFeed } from './donors-feed';
import { TYPES } from './lib/types';
import * as http from 'http';
let kernel = new Kernel();
kernel.load(infra, commands, queries, controllers);
let server = new InversifyExpressServer(kernel);
let httpServer = http.createServer();
server.setConfig((app) => {
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(morgan('combined'));
app.use(cors({
origin: (origin, callback) => {
try {
let ok: boolean = config.originsWhitelist.indexOf(origin) !== -1
callback(null, ok);
示例3: Kernel
import { Kernel } from 'inversify';
import { diModule } from 'retax-di';
const kernel = new Kernel();
kernel.load(diModule);
export default kernel;
示例4: createKernel
export function createKernel(option?: KernelOption) {
let kernel = new i.Kernel();
kernel.load(CoreModules);
return new Kernel(kernel);
}