當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript restify.acceptParser函數代碼示例

本文整理匯總了TypeScript中restify.acceptParser函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript acceptParser函數的具體用法?TypeScript acceptParser怎麽用?TypeScript acceptParser使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了acceptParser函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

    constructor(name: string) {
        this.router = Restify.createServer({
            name: name
        });

        this.router.on('listening', () => {
            log.debug(`${this.router.name} listening on ${this.router.url}`);
        });

        this.router.use(Restify.acceptParser(this.router.acceptable));
        this.router.use(stripEmptyBearerToken);
        this.router.use(Restify.dateParser());
        this.router.use(Restify.queryParser());
    }
開發者ID:kpreeti096,項目名稱:BotFramework-Emulator,代碼行數:14,代碼來源:restServer.ts

示例2: bootstrap

  public bootstrap(port: number) {
    this.restifyApplication.use(restify.CORS());
    this.restifyApplication.use(restify.pre.sanitizePath());
    this.restifyApplication.use(restify.acceptParser(this.restifyApplication.acceptable));
    this.restifyApplication.use(restify.bodyParser());
    this.restifyApplication.use(restify.queryParser());
    this.restifyApplication.use(restify.authorizationParser());
    this.restifyApplication.use(restify.fullResponse());

    // configure API and error routes
    this.restifyContactRouter.configApiRoutes(this.restifyApplication);
    this.restifyContactRouter.configErrorRoutes(this.restifyApplication);
    // listen on provided ports
    this.restifyApplication.listen(port, () => {
      console.log("%s listening at %s", this.restifyApplication.name, this.restifyApplication.url);
    });
  }
開發者ID:rajajhansi,項目名稱:aspnetcore-aurelia-tutorial,代碼行數:17,代碼來源:restify-application.ts

示例3: function

import * as restify from "restify";
import * as routes from "./routes";

//config
export const server = restify.createServer({
    name: 'myAPI',
    version: '1.0.0'
});

//parsing settings
server.use(restify.acceptParser(server.acceptable));
server.use(restify.queryParser());
server.use(restify.bodyParser());
server.pre(restify.pre.sanitizePath());

//call the routes.ts file for available REST API routes
console.log('setting routes...');
routes.setRoutes(server);

//when running the app will listen locally to port 51234
server.listen(51234, function() {
    console.log('%s listening at %s', server.name, server.url);
})

開發者ID:jeffhollan,項目名稱:typescriptRestifyAPI,代碼行數:23,代碼來源:app.ts


注:本文中的restify.acceptParser函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。