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


TypeScript koa-router.patch函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。