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

TypeScript koa-router.head函数代码示例

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

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



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

示例1: constructor

	constructor() {
		const storage = new FileStorage();
		this.router = storage.storageRouter(false);

		// this is usually handled by nginx directly, but might be used as fallback when there's no file before processors finish.
		this.router.head('/files/:id.:ext',            storage.head.bind(storage));
		this.router.head('/files/:variation/:id.:ext', storage.head.bind(storage));
		this.router.get('/files/:id.:ext',             storage.get.bind(storage));
		this.router.get('/files/:variation/:id.:ext',  storage.get.bind(storage));
	}
开发者ID:freezy,项目名称:node-vpdb,代码行数:10,代码来源:file.storage.router.ts


示例2: constructor

	constructor() {
		const api = new GameApi();
		this.router = api.apiRouter();

		this.router.get('/v1/games',       api.list.bind(api));
		this.router.head('/v1/games/:id',  api.head.bind(api));
		this.router.get('/v1/games/:id',   api.view.bind(api));
		this.router.patch('/v1/games/:id',  api.auth(api.update.bind(api), 'games', 'update-own', [ Scope.ALL ]));
		this.router.post('/v1/games',       api.auth(api.create.bind(api), 'games', 'add-og', [ Scope.ALL ]));
		this.router.delete('/v1/games/:id', api.auth(api.del.bind(api), 'games', 'delete', [ Scope.ALL ]));

		const ratingApi = new RatingApi();
		this.router.post('/v1/games/:id/rating', api.auth(ratingApi.createForGame.bind(ratingApi), 'games', 'rate', [ Scope.ALL, Scope.COMMUNITY ]));
		this.router.put('/v1/games/:id/rating',  api.auth(ratingApi.updateForGame.bind(ratingApi), 'games', 'rate', [ Scope.ALL, Scope.COMMUNITY ]));
		this.router.get('/v1/games/:id/rating',  api.auth(ratingApi.getForGame.bind(ratingApi), 'games', 'rate', [ Scope.ALL, Scope.COMMUNITY ]));
		this.router.delete('/v1/games/:id/rating',  api.auth(ratingApi.deleteForGame.bind(ratingApi), 'games', 'rate', [ Scope.ALL, Scope.COMMUNITY ]));

		const starsApi = new StarApi();
		this.router.post('/v1/games/:id/star',   api.auth(starsApi.star('game').bind(starsApi), 'games', 'star', [ Scope.ALL, Scope.COMMUNITY ]));
		this.router.delete('/v1/games/:id/star', api.auth(starsApi.unstar('game').bind(starsApi), 'games', 'star', [ Scope.ALL, Scope.COMMUNITY ]));
		this.router.get('/v1/games/:id/star',    api.auth(starsApi.get('game').bind(starsApi), 'games', 'star', [ Scope.ALL, Scope.COMMUNITY ]));

		const backglassApi = new BackglassApi();
		this.router.post('/v1/games/:gameId/backglasses', api.auth(backglassApi.create.bind(backglassApi), 'backglasses', 'add', [ Scope.ALL, Scope.CREATE ]));
		this.router.get('/v1/games/:gameId/backglasses', backglassApi.list.bind(backglassApi));

		const mediumApi = new MediumApi();
		this.router.get('/v1/games/:gameId/media', mediumApi.list.bind(mediumApi));

		const eventsApi = new LogEventApi();
		this.router.get('/v1/games/:id/events', eventsApi.list({ byGame: true }).bind(eventsApi));
		this.router.get('/v1/games/:id/release-name', api.auth(api.releaseName.bind(api), 'releases', 'add', [ Scope.ALL, Scope.CREATE ]));
	}
开发者ID:freezy,项目名称:node-vpdb,代码行数:33,代码来源:game.api.router.ts


示例3: constructor

	constructor() {
		const storage = new ReleaseStorage();
		this.router = storage.storageRouter(true);

		this.router.head('/v1/releases/:release_id',       storage.auth(storage.checkDownload.bind(storage), 'files', 'download', [ Scope.ALL, Scope.STORAGE ]));
		this.router.get('/v1/releases/:release_id',        storage.auth(storage.download.bind(storage), 'files', 'download', [ Scope.ALL, Scope.STORAGE ]));
		this.router.post('/v1/releases/:release_id',       storage.auth(storage.download.bind(storage), 'files', 'download', [ Scope.ALL, Scope.STORAGE ]));
		this.router.get('/v1/releases/:release_id/thumb', storage.thumbRedirect.bind(storage));
	}
开发者ID:freezy,项目名称:node-vpdb,代码行数:9,代码来源:release.storage.router.ts


示例4: async

  router.head(`/${resource}`, async (ctx, next) => {
    let filter: Expression = true;
    if (ctx.request.query.filter) filter = parse(ctx.request.query.filter);

    const log = {
      message: `Count ${resource}`,
      context: ctx,
      filter: ctx.request.query.filter,
      count: null
    };

    if (!ctx.state.authorizer.hasAccess(resource, 1)) {
      logUnauthorizedWarning(log);
      return void next();
    }

    // Exclude temporary tasks and faults
    if (resource === "tasks" || resource === "faults") {
      filter = and(filter, [
        "NOT",
        ["<", ["PARAM", "expiry"], Date.now() + 60000]
      ]);
    }

    const count = await db.count(resource, filter);

    ctx.set("X-Total-Count", `${count}`);
    ctx.body = "";

    log.count = count;
    logger.accessInfo(log);
  });
开发者ID:zaidka,项目名称:genieacs,代码行数:32,代码来源:api.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript koa-router.patch函数代码示例发布时间:2022-05-25
下一篇:
TypeScript koa-router.get函数代码示例发布时间: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