How to use the ts-express-decorators.ServerSettings function in ts-express-decorators

To help you get started, we’ve selected a few ts-express-decorators 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 scopsy / node-typescript-starter / src / app.ts View on Github external
import * as Path from 'path';
import * as dotenv from 'dotenv';
import * as logger from 'morgan';
import * as express from 'express';
import * as bodyParser from 'body-parser';
import * as compression from 'compression';

dotenv.config({ path: '.env' });

import { ServerLoader, ServerSettings, GlobalAcceptMimesMiddleware } from 'ts-express-decorators';
import { $log } from 'ts-log-debug';
import { MongooseService } from './services/shared/mongoose.service';

const rootDir = Path.resolve(__dirname);
@ServerSettings({
    rootDir,
    mount: {
        '/v1': `${rootDir}/controllers/**/**.controller.{ts,js}`
    },
    componentsScan: [
        `${rootDir}/services/**/**.service.{ts,js}`,
        `${rootDir}/middlewares/**/**.{ts,js}`,
        `${rootDir}/dal/**/**.{ts,js}`
    ],
    httpPort: process.env.PORT || 3000,
    httpsPort: false,
    acceptMimes: ['application/json'],
    swagger: {
        path: '/api-docs'
    }
})