本文整理汇总了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;未经允许,请勿转载。 |
请发表评论