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

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

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

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



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

示例1: 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


示例2: constructor

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

		this.router.get('/v1/builds',       api.list.bind(api));
		this.router.post('/v1/builds',       api.auth(api.create.bind(api), 'builds', 'add', [ Scope.ALL, Scope.CREATE ]));
		this.router.get('/v1/builds/:id',   api.view.bind(api));
		this.router.patch('/v1/builds/:id',  api.auth(api.update.bind(api), 'builds', 'update', [ Scope.ALL, Scope.CREATE ]));
		this.router.delete('/v1/builds/:id', api.auth(api.del.bind(api), 'builds', 'delete-own', [ Scope.ALL, Scope.CREATE ]));
	}
开发者ID:freezy,项目名称:node-vpdb,代码行数:10,代码来源:build.router.ts


示例3: constructor

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

		this.router.post('/v1/tokens',      api.auth(api.create.bind(api), 'tokens', 'add', [ Scope.ALL ]));
		this.router.get('/v1/tokens',       api.auth(api.list.bind(api), 'tokens', 'list', [ Scope.ALL ], { enableAppTokens: true }));
		this.router.get('/v1/tokens/:id',  api.view.bind(api));
		this.router.del('/v1/tokens/:id',   api.auth(api.del.bind(api), 'tokens', 'delete-own', [ Scope.ALL ]));
		this.router.patch('/v1/tokens/:id', api.auth(api.update.bind(api), 'tokens', 'update-own', [ Scope.ALL ]));
	}
开发者ID:freezy,项目名称:node-vpdb,代码行数:10,代码来源:token.api.router.ts


示例4: constructor

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

		this.router.get('/v1/profile',               api.auth(api.view.bind(api), 'user', 'view', [ Scope.ALL, Scope.COMMUNITY ]));
		this.router.patch('/v1/profile',             api.auth(api.update.bind(api), 'user', 'update', [ Scope.ALL ]));
		this.router.get('/v1/profile/confirm/:tkn', api.confirm.bind(api));
		this.router.post('/v1/profile/request-password-reset', api.requestResetPassword.bind(api));
		this.router.post('/v1/profile/password-reset',         api.resetPassword.bind(api));

		const logApi = new LogUserApi();
		this.router.get('/v1/profile/logs',          api.auth(logApi.list.bind(api), 'user', 'view', [ Scope.ALL ]));

		const eventsApi = new LogEventApi();
		this.router.get('/v1/profile/events',        api.auth(eventsApi.list({ loggedUser: true }).bind(eventsApi), 'user', 'view', [ Scope.ALL ]));

		// deprecated, remove when clients are updated.
		this.router.get('/v1/user',               api.auth(api.view.bind(api), 'user', 'view', [ Scope.ALL, Scope.COMMUNITY ]));
		this.router.patch('/v1/user',             api.auth(api.update.bind(api), 'user', 'update', [ Scope.ALL ]));
		this.router.get('/v1/user/logs',          api.auth(logApi.list.bind(api), 'user', 'view', [ Scope.ALL ]));
		this.router.get('/v1/user/events',        api.auth(eventsApi.list({ loggedUser: true }).bind(eventsApi), 'user', 'view', [ Scope.ALL ]));
		this.router.get('/v1/user/confirm/:tkn', api.confirm.bind(api));
	}
开发者ID:freezy,项目名称:node-vpdb,代码行数:23,代码来源:profile.api.router.ts


示例5: default

export default () => {
    const router = new Router();

    router.get('/test', Test.index);

    router.get('/admin/people/features', Admin.createHelperFeature);
    router.post('/admin/features', Admin.createFeature);
    router.post('/admin/helper', Admin.createHelper);
    router.patch('/admin/helper', Admin.updateHelper);
    router.get('/admin/helper/features', Admin.createAssistancePeople);

    router.get('/platform/', Platform.index);
    router.post('/platform/teacher', Platform.teacher);
    router.get('/platform/helper', Platform.client);
    router.get('/platform/others/a', Platform.a);
    router.get('/platform/others/b', Platform.b);
    router.get('/platform/assistance-list', Platform.assistanceList);
    router.post('/platform/help', Platform.help);
    router.del('/platform/help/:id', Platform.delHelp);
    router.get('/platform/helper/features', Platform.helperFeatures);
    router.get('/platform/new-assistance', Platform.newAssistance);

    router.get('/teacher/', Teacher.index);
    router.get('/teacher/json', Teacher.json);
    router.get('/teacher/string', Teacher.string);
    router.get('/teacher/test', Teacher.test);

    router.get('/client/', Client.index);
    router.get('/client/bar', Client.bar);

    router.get('/others/', Other.index);
    router.get('/others/a', Other.a);
    router.get('/others/b', Other.b);
    router.get('/others/c', Other.c);

    router.get('/test/', Test.index);

    return router;
}
开发者ID:yuedun,项目名称:nodejs-koa,代码行数:39,代码来源:router.ts


示例6: Router

import { getAllPeople } from './people';
import { addTodo, deleteTodo, getAllTodo, getTodo, patchTodo } from './todo';

// Tip:
// For more complex applications, consider using a dependency injection
// framework like InversifyJS. There are plugins for express and koa (see also
// e.g. https://www.npmjs.com/package/inversify-koa-utils)

// Read more about routing at https://github.com/alexmingoia/koa-router
const router = new Router({prefix: '/api'});
router.get('/people', getAllPeople);
router.get('/todos', getAllTodo);
router.get('/todos/:id', getTodo);
router.post('/todos', addTodo);
router.patch('/todos/:id', patchTodo);
router.delete('/todos/:id', deleteTodo);

// Read more about koa at http://koajs.com/
const app = new Koa();
app.use(cors());
app.use(logger());
app.use(bodyParser());
app.use(router.routes());

// Read more about koa views at https://github.com/queckezz/koa-views
// Read more about Nunjucks at https://mozilla.github.io/nunjucks/
const viewPath = path.join(__dirname, 'views');
app.use(views(viewPath, {
  map: {html: 'nunjucks'},
  options: {loader: new FileSystemLoader(viewPath)}
开发者ID:,项目名称:,代码行数:30,代码来源:


示例7: Router

import * as Router from 'koa-router';
import * as controller from './customer.controller';

const router = new Router();

router.get('/', controller.getAll);
router.get('/:id', controller.get);
router.post('/', controller.create);
router.put('/:id', controller.update);
router.patch('/:id', controller.update);
router.delete('/:id', controller.destroy);

export default router.routes();
开发者ID:ghiscoding,项目名称:Realtime-TODO-Aurelia-RethinkDB,代码行数:13,代码来源:index.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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