Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import "reflect-metadata";
import { Container } from 'inversify';
import { interfaces as IExpressUtils, InversifyExpressServer, TYPE } from 'inversify-express-utils';
import Song from './api/controllers/Song';
import { TYPES } from './Types';
import config from './config';
import AudioSource from './api/services/media_providers/AudioSource';
import AudioFactory from './api/services/media_providers/AudioFactory';
import DiskSource from './api/services/media_providers/disk/DiskSource';
import DiskFactory from './api/services/media_providers/disk/DiskFactory';
let container = new Container();
container.bind(TYPE.Controller).to(Song).whenTargetNamed('Song');
container.bind(TYPES.AudioSource).to(DiskSource);
container.bind(TYPES.AudioFactory).to(DiskFactory);
container.bind(TYPES.Config).toConstantValue(config);
// create server
let server = new InversifyExpressServer(container);
server
.build()
.listen(config.webServer.port, config.webServer.bind_address, () => {
console.log('Now listening on ' + config.webServer.bind_address + ':' + config.webServer.port);
});
container.bind('InvestValidation').toConstantValue(
(req: any, res: any, next: any) => validation.invest(req, res, next)
);
container.bind('OnlyJumioIp').toConstantValue(
(req: any, res: any, next: any) => validation.onlyJumioIp(req, res, next)
);
container.bind('ResendVerificationValidation').toConstantValue(
(req: any, res: any, next: any) => validation.resendVerification(req, res, next)
);
container.bind('OnlyAcceptApplicationJson').toConstantValue(
(req: any, res: any, next: any) => validation.onlyAcceptApplicationJson(req, res, next)
);
// controllers
container.bind(TYPE.Controller).to(UserController).whenTargetNamed('UserController');
container.bind(TYPE.Controller).to(DashboardController).whenTargetNamed('DashboardController');
container.bind(TYPE.Controller).to(KycController).whenTargetNamed('KycController');
container.bind(TYPE.Controller).to(GatewayController).whenTargetNamed('GatewayController');
export { container };
import { CustomerRepository } from './domain/customer-repository';
import { TypeORMCustomerRepository } from './infrastructure/db/typeorm/typeorm-customer-repository';
import { CustomerApplicationService } from './application/customer/customer-application-service';
import { MovieStoreApplicationService } from './application/movie/movie-store-application-service';
import { MovieController } from './presentation/rest/movie.controller';
import { CustomerController } from './presentation/rest/customer-controller';
const container = new Container();
// Customer
container.bind(TYPE.Controller).to(CustomerController).inSingletonScope().whenTargetNamed('CustomerController');
container.bind('CustomerApplicationService').to(CustomerApplicationService).inSingletonScope();
container.bind('CustomerRepository').to(TypeORMCustomerRepository).inSingletonScope();
// Movies
container.bind(TYPE.Controller).to(MovieController).inSingletonScope().whenTargetNamed('MovieController');
container.bind('MovieStoreApplicationService').to(MovieStoreApplicationService).inSingletonScope();
container.bind('MovieRepository').to(TypeORMMovieRepository).inSingletonScope();
// Database
container.bind('TypeORMConnectionService').to(TypeORMConnectionService).inSingletonScope();
export {
container
};
);
container.bind('InvestValidation').toConstantValue(
(req: any, res: any, next: any) => validation.invest(req, res, next)
);
container.bind('OnlyJumioIp').toConstantValue(
(req: any, res: any, next: any) => validation.onlyJumioIp(req, res, next)
);
container.bind('ResendVerificationValidation').toConstantValue(
(req: any, res: any, next: any) => validation.resendVerification(req, res, next)
);
container.bind('OnlyAcceptApplicationJson').toConstantValue(
(req: any, res: any, next: any) => validation.onlyAcceptApplicationJson(req, res, next)
);
// controllers
container.bind(TYPE.Controller).to(UserController).whenTargetNamed('UserController');
container.bind(TYPE.Controller).to(DashboardController).whenTargetNamed('DashboardController');
container.bind(TYPE.Controller).to(KycController).whenTargetNamed('KycController');
container.bind(TYPE.Controller).to(GatewayController).whenTargetNamed('GatewayController');
export { container };
import { interfaces, TYPE } from 'inversify-express-utils';
import { Container } from 'inversify';
import { TypeORMMovieRepository } from './infrastructure/db/typeorm/typeorm-movie-repository';
import { MovieRepository } from './domain/movie-repository';
import { TypeORMConnectionService } from './infrastructure/db/typeorm/typeorm-connection-service';
import { CustomerRepository } from './domain/customer-repository';
import { TypeORMCustomerRepository } from './infrastructure/db/typeorm/typeorm-customer-repository';
import { CustomerApplicationService } from './application/customer/customer-application-service';
import { MovieStoreApplicationService } from './application/movie/movie-store-application-service';
import { MovieController } from './presentation/rest/movie.controller';
import { CustomerController } from './presentation/rest/customer-controller';
const container = new Container();
// Customer
container.bind(TYPE.Controller).to(CustomerController).inSingletonScope().whenTargetNamed('CustomerController');
container.bind('CustomerApplicationService').to(CustomerApplicationService).inSingletonScope();
container.bind('CustomerRepository').to(TypeORMCustomerRepository).inSingletonScope();
// Movies
container.bind(TYPE.Controller).to(MovieController).inSingletonScope().whenTargetNamed('MovieController');
container.bind('MovieStoreApplicationService').to(MovieStoreApplicationService).inSingletonScope();
container.bind('MovieRepository').to(TypeORMMovieRepository).inSingletonScope();
// Database
container.bind('TypeORMConnectionService').to(TypeORMConnectionService).inSingletonScope();
export {
container
};
import { SwaggerDefinitionConstant } from 'swagger-express-ts';
const config = require('../config.json');
import { CarController } from './cars/car.controller';
import { CarsService } from './cars/cars.service';
import * as _ from 'lodash';
// import models
import './cars/car.model';
import './constructors/constructor.model';
// set up container
const container = new Container();
// note that you *must* bind your controllers to Controller
container
.bind(TYPE.Controller)
.to(CarsController)
.inSingletonScope()
.whenTargetNamed(CarsController.name);
container
.bind(TYPE.Controller)
.to(CarController)
.inSingletonScope()
.whenTargetNamed(CarController.name);
container
.bind(CarsService.name)
.to(CarsService)
.inSingletonScope();
// create server
const server = new InversifyExpressServer(container);
server.setConfig((app: any) => {
// import models
import './cars/car.model';
import './constructors/constructor.model';
// set up container
const container = new Container();
// note that you *must* bind your controllers to Controller
container
.bind(TYPE.Controller)
.to(CarsController)
.inSingletonScope()
.whenTargetNamed(CarsController.name);
container
.bind(TYPE.Controller)
.to(CarController)
.inSingletonScope()
.whenTargetNamed(CarController.name);
container
.bind(CarsService.name)
.to(CarsService)
.inSingletonScope();
// create server
const server = new InversifyExpressServer(container);
server.setConfig((app: any) => {
app.use('/api-docs/swagger', express.static('swagger'));
app.use(
'/api-docs/swagger/assets',
express.static('node_modules/swagger-ui-dist')
);
import "reflect-metadata";
import express = require('express');
import { Container } from 'inversify';
import { interfaces, InversifyExpressServer, TYPE } from 'inversify-express-utils';
import * as bodyParser from 'body-parser';
import { ListController, SettingsController, SonarrController, TraktTVController } from './controllers';
import { TraktTVService, SonarrService, ListService, SettingsService, SyncRunnerService } from './services';
import { TraktTVRepository, SonarrRepository, DBRepository, SettingsDBRepository } from './repositories';
let container = new Container();
container.bind(TYPE.Controller).to(ListController).whenTargetNamed('ListController');
container.bind(TYPE.Controller).to(SettingsController).whenTargetNamed('SettingsController');
container.bind(TYPE.Controller).to(SonarrController).whenTargetNamed('SonarrController');
container.bind(TYPE.Controller).to(TraktTVController).whenTargetNamed('TraktTVController');
container.bind('TraktTVService').to(TraktTVService);
container.bind('TraktTVRepository').to(TraktTVRepository);
container.bind('SonarrService').to(SonarrService);
container.bind('SonarrRepository').to(SonarrRepository);
container.bind('DBRepository').to(DBRepository);
container.bind('ListService').to(ListService);
container.bind('SyncRunnerService').to(SyncRunnerService);
container.bind('SettingsService').to(SettingsService);
container.bind('SettingsDBRepository').to(SettingsDBRepository);
let server = new InversifyExpressServer(container);
server.setConfig((app) => {
import "reflect-metadata";
import express = require('express');
import { Container } from 'inversify';
import { interfaces, InversifyExpressServer, TYPE } from 'inversify-express-utils';
import * as bodyParser from 'body-parser';
import { ListController, SettingsController, SonarrController, TraktTVController } from './controllers';
import { TraktTVService, SonarrService, ListService, SettingsService, SyncRunnerService } from './services';
import { TraktTVRepository, SonarrRepository, DBRepository, SettingsDBRepository } from './repositories';
let container = new Container();
container.bind(TYPE.Controller).to(ListController).whenTargetNamed('ListController');
container.bind(TYPE.Controller).to(SettingsController).whenTargetNamed('SettingsController');
container.bind(TYPE.Controller).to(SonarrController).whenTargetNamed('SonarrController');
container.bind(TYPE.Controller).to(TraktTVController).whenTargetNamed('TraktTVController');
container.bind('TraktTVService').to(TraktTVService);
container.bind('TraktTVRepository').to(TraktTVRepository);
container.bind('SonarrService').to(SonarrService);
container.bind('SonarrRepository').to(SonarrRepository);
container.bind('DBRepository').to(DBRepository);
container.bind('ListService').to(ListService);
container.bind('SyncRunnerService').to(SyncRunnerService);
container.bind('SettingsService').to(SettingsService);
container.bind('SettingsDBRepository').to(SettingsDBRepository);
let server = new InversifyExpressServer(container);
server.setConfig((app) => {
app.use(bodyParser.urlencoded({
export function registerController(
bind: interfaces.Bind,
constructor: interfaces.Newable
) {
bind(TYPE.Controller)
.to(constructor)
.whenTargetNamed(constructor.name);
}