How to use the routing-controllers.useExpressServer function in routing-controllers

To help you get started, we’ve selected a few routing-controllers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rafaell-lycan / sabesp-mananciais-api / src / application.ts View on Github external
private controllers(app: Application): void {
    logger.debug('Configuring routes...');
    // const controllers = [`${__dirname}/controllers/*`];

    useExpressServer(app, {
      controllers: [IndexController, ApiV2Controller, ApiV1Controller],
      middlewares: [
        // custom middlewares
        Analytics,
        NotFoundHandler,
        ErrorHandler,
      ],
      defaultErrorHandler: false,
    });
  }
github swimlane / node-microservice-demo / petstore / src / config / Express.ts View on Github external
setupControllers() {
    const controllersPath = path.resolve('dist', 'controllers');

    useExpressServer(this.app, {
      controllerDirs: [ controllersPath ],
      container: Container
    });
  }
github art-software / art-core / packages / art-server-mock-miniprogram / src / Application.ts View on Github external
private createApp(): Application {
    const app = express();
    const publicPath = join(process.cwd(), './public');
    app.use('/public', compression(), express.static(publicPath));
    useExpressServer(app, {
      routePrefix: '/mock_api',
      controllers: this.controllers()
    });
    return app;
  }
github swimlane / node-microservice-demo / users / src / config / Express.ts View on Github external
setupControllers() {
    const controllersPath = path.resolve('dist', 'controllers');
    useExpressServer(this.app, {
      controllerDirs: [ controllersPath ]
    });
  }
github art-software / art-core / packages / art-ssr-render / src / RenderServer.ts View on Github external
private initApplication() {
    this.app.use(bodyParser.json(this.config.bodyParser));
    this.app.use(compression());
    useExpressServer(this.app, {
      controllers: [join(__dirname, './controllers/render/RenderController.js')]
    });
  }
github ChatPlug / ChatPlug / src / services / api / ApiService.ts View on Github external
async initialize() {
    useContainer(new ContextContainer(this.context))
    const serv = express()
    serv.use(cors())
    this.app = useExpressServer(serv, {
      routePrefix: '/api/v1',
      controllers: [ConnectionsController, ServicesController],
      middlewares: [ErrorMiddleware],
      interceptors: [ResponseMiddleware],
      defaultErrorHandler: false,
    }) as Application

    this.wsServer = new WebsocketServer({
      port: 2136,
    })

    this.statusSubscription = this.context.serviceManager.statusSubject.subscribe(
      el => {
        this.broadcastPacket({
          namespace: 'services',
          mutation: SocketEvent.ServiceStatusUpdate,
github patrickmichalina / fusing-angular-v1-archived / src / server / rest-api / index.ts View on Github external
const getTokenFromAction = (action: Action) => {
    const clientAccessToken =
      action.request.headers.cookie &&
      parse(action.request.headers.cookie as any)[appAuthAccessTokenKey]
    const clientIdToken =
      action.request.headers.cookie &&
      parse(action.request.headers.cookie as any)[appAuthIdTokenKey]

    return {
      clientAccessToken,
      clientIdToken
    }
  }

  configApi(app, {
    authorizationChecker: async (
      action: Action,
      roles: ReadonlyArray
    ) => {
      const tokenTuple = getTokenFromAction(action)
      return auth0ServerValidationNoAngularFactory(
        azNoAngular,
        tokenTuple.clientAccessToken,
        tokenTuple.clientIdToken
      )
        .pipe(
          map(user => {
            const uroles =
              (user && (user as any)[process.env.AUTH0_ROLES_KEY as string]) ||
              {}
            const userRoles: ReadonlyArray = Object.keys(uroles).filter(
github art-software / art-core / packages / art-server-mock / dist / Application.js View on Github external
createApp() {
        const app = express_1.default();
        const publicPath = path_1.join(process.cwd(), './public');
        app.use(serve_favicon_1.default(path_1.join(__dirname, '../favicon.ico')));
        app.use('/public', compression_1.default(), express_1.default.static(publicPath));
        const vendorPath = path_1.join(__dirname, '../../art-lib-react/dist/vendors/');
        app.use('/static', compression_1.default(), express_1.default.static(vendorPath));
        this.appTemplate(app);
        routing_controllers_1.useExpressServer(app, {
            routePrefix: '/mock_api',
            controllers: this.controllers()
        });
        this.appIndexPage(app);
        return app;
    }
    start() {