• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript compression.default函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中compression.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了default函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: createExpressApp

function createExpressApp()
{
	var app = express();
	app.use((req, resp, next) =>
	{
		//console.log(`${req.method} ${req.path}`);
		next();
	})

	var mainhtml = 'build/main.html';
	var path = __dirname + '/../../../client/dist';

	app.all('/api/builder/version', builder_api.builder_version_express_handler());
	app.all('/api/builder/content', builder_api.builder_content_express_handler());
	app.get('/api/query_userinfo', ManagerApi.query_user_info_handler());
	app.get('/api/add_mail', ManagerApi.add_mail_handler());
	//下面两个地址,其实其实取决于 builder.api 中的地址
	//app.use(/\/builder\/content\/.*/, compression());
	//app.use(/\/builder\/webworker\/.*/, compression());
	app.all(/\/builder\/content\/.*/, compression(), builder_api.builder_content_express_handler());
	app.all(/\/builder\/webworker\/.*/, compression(), (req, resp) =>
	{
		resp.contentType('application/javascript');
		resp.end(builder.getWebWorkerJavascript());
	})
	app.use(express.static(path, { index: mainhtml }));
	app.all('/payend', bodyParser.urlencoded({ extended: false }), cash.pay_end_express_handler());
	builder.watchAndBuild();
	return app;
}
开发者ID:hUangDDD,项目名称:bally,代码行数:30,代码来源:main.ts


示例2: require

    $onMountingMiddlewares(): void|Promise<any> {
        const morgan = require('morgan'),
            cookieParser = require('cookie-parser'),
            bodyParser = require('body-parser'),
            compress = require('compression'),
            methodOverride = require('method-override');


        this
            .use(morgan('dev'))
            .use(ServerLoader.AcceptMime("application/json"))

            .use(cookieParser())
            .use(compress({}))
            .use(methodOverride())
            .use(bodyParser.json())
            .use(bodyParser.urlencoded({
                extended: true
            }));

        let asyncPromises = this.mqttServer
            .then((server : any) => server.attachHttpServer(this.httpServer));

        return asyncPromises;
    }
开发者ID:PiStation,项目名称:pistation-api,代码行数:25,代码来源:server.ts


示例3: function

module.exports = function(app) {

    var env = config.env;

    app.set('view engine', 'html');
    app.use(bodyParser.urlencoded({ extended: false }));
    app.use(bodyParser.json());
    app.use(compression());
    app.use(morgan('dev')); 
    app.use(passport.initialize()); 
    app.use(express.static(path.join(config.root, 'client')));
    app.set('appPath', 'client'); 

    app.use(session({
        secret: config.secrets.session,
        resave: true,
        saveUninitialized: true,
        store: new mongoStore({ mongooseConnection: mongoose.connection })
    })); 

    if (env === 'development' || env === 'test') {
        app.use(require('errorhandler')());
    }

};
开发者ID:rhushi-lokhande,项目名称:Team-Stack,代码行数:25,代码来源:express.ts


示例4:

  $onMountingMiddlewares(): void | Promise<any> {
    this
      .use(GlobalAcceptMimesMiddleware)
      .use(cookieParser())
      .use(compress({}))
      .use(methodOverride())
      .use(bodyParser.json())
      .use(bodyParser.urlencoded({
        extended: true
      }))
      .use(session({
        secret: "mysecretkey",
        resave: true,
        saveUninitialized: true,
        maxAge: 36000,
        cookie: {
          path: "/",
          httpOnly: true,
          secure: false,
          maxAge: null
        }
      }));

    return null;
  }
开发者ID:Romakita,项目名称:ts-express-decorators,代码行数:25,代码来源:Server.ts


示例5: require

  /**
   * This method let you configure the middleware required by your application to works.
   * @returns {Server}
   */
  public $onMountingMiddlewares(): void {
    const cookieParser = require("cookie-parser"),
      bodyParser = require("body-parser"),
      compress = require("compression"),
      methodOverride = require("method-override"),
      expressSession = require("express-session");

    this.use(TestAcceptMimeMiddleware)
      .use(bodyParser.json())
      .use(
        bodyParser.urlencoded({
          extended: true
        })
      )
      .use(cookieParser())
      .use(compress({}))
      .use(methodOverride());

    this.engine(".html", require("ejs").__express)
      .set("views", `${rootDir}/views`)
      .set("view engine", "html");

    this.set("trust proxy", 1);
    this.use(
      expressSession({
        secret: "keyboard cat",
        resave: false,
        saveUninitialized: true,
        cookie: {}
      })
    );

    this.use(InitSessionMiddleware);
  }
开发者ID:Romakita,项目名称:ts-express-decorators,代码行数:38,代码来源:app.ts


示例6: setPageRoutes

export function setPageRoutes(app: express.Application): void {
  // Sets up the favicon
  app.use(favicon(config.server.staticFolder + '/favicon.ico'));
  // First looks for a static file: index.html, css, images, etc.
  app.use(config.server.staticUrl, compress());
  app.use(config.server.staticUrl, static(config.server.staticFolder));
  app.use(config.server.staticUrl, (req: express.Request, res: express.Response, next: (err?: any) => void) => {
    res.send(404);
  });
}
开发者ID:uievolutionkk,项目名称:jsonrpc-mock-server,代码行数:10,代码来源:app.ts


示例7: setupMiddlewares

function setupMiddlewares(app: express.Express, config: IExpressConfig) {
  app.use((req, res, next) => {
    if (req.headers && req.headers['content-type']) {
      req.headers['content-type'] = req.headers['content-type'].replace(/euc-kr/ig, 'utf-8');
    }
    next();
  });
  app.use(compression());
  app.use(bodyParser.json({ limit: config.max_body_size || '10mb' }));
  app.use(bodyParser.urlencoded({ limit: config.max_body_size || '10mb', extended: true }));
  app.use(cookieParser());
}
开发者ID:croquiscom,项目名称:Crary-Node,代码行数:12,代码来源:create_app.ts


示例8:

  /**
   * This method let you configure the middleware required by your application to works.
   * @returns {Server}
   */
  $onMountingMiddlewares(): void | Promise<any> {
    this
      .use(GlobalAcceptMimesMiddleware)
      .use(cookieParser())
      .use(compress({}))
      .use(methodOverride())
      .use(bodyParser.json())
      .use(bodyParser.urlencoded({
        extended: true
      }));

    return null;
  }
开发者ID:Romakita,项目名称:ts-express-decorators,代码行数:17,代码来源:Server.ts


示例9: config

  private config() {
    this.app.use(bodyParser.json())
    this.app.use(bodyParser.urlencoded({ extended: true }))

    this.app.use(cors())
    this.app.use(compression())

    this.app.use((err: any, req, res, next) => {
      err.status = 404
      next(err)
    })

    this.app.use(errorHandler())
  }
开发者ID:magic8bot,项目名称:magic8bot,代码行数:14,代码来源:server.ts


示例10: serveCoverage

export function serveCoverage() {
  let server = express();
  let compression = require('compression');
      server.use(compression());

  server.use(
    Config.APP_BASE,
    express.static(resolve(process.cwd(), 'coverage'))
  );

  server.listen(Config.COVERAGE_PORT, () =>
    openResource('http://localhost:' + Config.COVERAGE_PORT + Config.APP_BASE)
  );
}
开发者ID:Sjiep,项目名称:angular2-seed,代码行数:14,代码来源:server.ts



注:本文中的compression.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript confidence.Store类代码示例发布时间:2022-05-25
下一篇:
TypeScript html.div函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap