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


TypeScript Express.post方法代碼示例

本文整理匯總了TypeScript中express.Express.post方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Express.post方法的具體用法?TypeScript Express.post怎麽用?TypeScript Express.post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在express.Express的用法示例。


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

示例1: defineRoutes

 defineRoutes(): void {
     this.app.get(RestService.generateRoute(Api.CHARACTERS, CharactersActions.getCharacterById), this.charactersComponent.getCharactersById);
     this.app.get(RestService.generateRoute(Api.CHARACTERS, CharactersActions.getCharacters), this.charactersComponent.getCharacters);
     this.app.post(RestService.generateRoute(Api.CHARACTERS, CharactersActions.createCharacters), this.charactersComponent.createCharacter);
     this.app.put(RestService.generateRoute(Api.CHARACTERS, CharactersActions.updateCharacterById), this.charactersComponent.updateCharacterById);
     this.app.delete(RestService.generateRoute(Api.CHARACTERS, CharactersActions.removeCharacterById), this.charactersComponent.removeCharacterById);
     this.app.post(RestService.generateRoute(Api.CHARACTERS, CharactersActions.searchCharacters), this.charactersComponent.searchCharacters);
 }
開發者ID:EmcaBorg,項目名稱:got,代碼行數:8,代碼來源:charactersRoutes.ts

示例2: addLogin

 private static addLogin(app: Express) {
   app.post('/api/user/login',
     AuthenticationMWs.inverseAuthenticate,
     AuthenticationMWs.login,
     RenderingMWs.renderSessionUser
   );
 }
開發者ID:bpatrik,項目名稱:PiGallery2,代碼行數:7,代碼來源:UserRouter.ts

示例3: setup

export function setup(app: Express) {
  app.post('/api/auth', handlers.auth);

  app.all('/api/*', passportHelper.ensureAuthenticated);

  app.get('/api/user/get/:user_id?', handlers.user.getById);

  app.get('/api/users/find(/:search_query?(/:page?)?)?', handlers.users.find);
  app.get('/api/users/find//:page', handlers.users.find);

  app.get('/api/friendships/getAll', handlers.friendships.getAll);

  app.post('/api/friendship/request/:user_id', handlers.friendship.request);
  app.post('/api/friendship/accept/:friendship_id', handlers.friendship.accept);
  app.post('/api/friendship/decline/:friendship_id', handlers.friendship.decline);
}
開發者ID:dmikheev,項目名稱:js-test-social-network,代碼行數:16,代碼來源:routes.ts

示例4: addIndexGallery

 private static addIndexGallery(app: Express) {
   app.get('/api/admin/indexes/job/progress',
     AuthenticationMWs.authenticate,
     AuthenticationMWs.authorise(UserRoles.Admin),
     AdminMWs.getIndexingProgress,
     RenderingMWs.renderResult
   );
   app.post('/api/admin/indexes/job',
     AuthenticationMWs.authenticate,
     AuthenticationMWs.authorise(UserRoles.Admin),
     AdminMWs.startIndexing,
     RenderingMWs.renderResult
   );
   app.delete('/api/admin/indexes/job',
     AuthenticationMWs.authenticate,
     AuthenticationMWs.authorise(UserRoles.Admin),
     AdminMWs.cancelIndexing,
     RenderingMWs.renderResult
   );
   app.delete('/api/admin/indexes',
     AuthenticationMWs.authenticate,
     AuthenticationMWs.authorise(UserRoles.Admin),
     AdminMWs.resetIndexes,
     RenderingMWs.renderResult
   );
 }
開發者ID:bpatrik,項目名稱:PiGallery2,代碼行數:26,代碼來源:AdminRouter.ts

示例5: addChangePassword

 private static addChangePassword(app: Express) {
   app.post('/api/user/:id/password',
     AuthenticationMWs.authenticate,
     UserRequestConstrainsMWs.forceSelfRequest,
     UserMWs.changePassword,
     RenderingMWs.renderOK
   );
 }
開發者ID:bpatrik,項目名稱:PiGallery2,代碼行數:8,代碼來源:UserRouter.ts

示例6: addChangeRole

 private static addChangeRole(app: Express) {
   app.post('/api/user/:id/role',
     AuthenticationMWs.authenticate,
     AuthenticationMWs.authorise(UserRoles.Admin),
     UserRequestConstrainsMWs.notSelfRequestOr2Admins,
     UserMWs.changeRole,
     RenderingMWs.renderOK
   );
 }
開發者ID:bpatrik,項目名稱:PiGallery2,代碼行數:9,代碼來源:UserRouter.ts

示例7: updatePerson

  private static updatePerson(app: Express) {
    app.post(['/api/person/:name'],
      // common part
      AuthenticationMWs.authenticate,
      AuthenticationMWs.authorise(Config.Client.Faces.writeAccessMinRole),
      VersionMWs.injectGalleryVersion,

      // specific part
      PersonMWs.updatePerson,
      RenderingMWs.renderResult
    );
  }
開發者ID:bpatrik,項目名稱:PiGallery2,代碼行數:12,代碼來源:PersonRouter.ts

示例8: attachToServer

 private attachToServer() {
     this.express.post(`/${this.instanceId}/:method`,
         e.json(),
         async (req: e.Request, res: e.Response) => {
             let method = req.params.method;
             let args = req.body || [];
             try {
                 let result = await this.instance[method](...args);
                 res.json(result);
             } catch (err) {
                 res.status(500).json(err);
             }
         });
 }
開發者ID:janexpando,項目名稱:holistify,代碼行數:14,代碼來源:controller-factory.ts

示例9: initRoutes

export async function initRoutes(app: Express) {
  console.log('Init routes...');

  app.set('trust proxy', 'loopback');
  app.use(compression());
  app.use(bodyParser.json());

  await db.init();
  stats.init();

  app.post('/vote', (req, res) => {
    const vote: Vote = req.body;
    if (isVoteValid(vote)) {
      stats.addVote(vote);
      db.saveVote(extend(vote, {
        date: new Date(),
        ip: req.ip,
        userAgent: req.get('User-Agent')
      })).then(oldVote => {
        if (oldVote) {
          stats.removeVote(oldVote);
        }
      });
    } else {
      console.log('Invalid vote', vote);
    }
    res.json({});
  });

  app.get('/stats', (_req, res) => {
    res.set('Cache-Control', 'max-age=' + 1);
    res.json(stats.getStats());
  });

  app.use(express.static('public'));

  app.set('views', './server/views');
  app.engine('handlebars', exphbs({ defaultLayout: 'main' }));
  app.set('view engine', 'handlebars');

  app.get(/^\/$|\/index.html/, (req, res) => {
    renderWithClientToken('index', req, res);
  });

  app.get('/iframe.html', (req, res) => {
    renderWithClientToken('iframe', req, res);
  });

};
開發者ID:shybyte,項目名稱:wahlomat,代碼行數:49,代碼來源:routes.ts

示例10: RegisterRoutes

    RegisterRoutes()
    {
         var self = this;

        this.app.put('/api/user', this.userController.Create);
        this.app.post('/api/user/:id', this.userController.Update);
        this.app.delete('/api/user/:id', this.userController.Delete);
        this.app.get('/api/user', function(req, res){
           self.onInit();
            return self.userController.GetByQuery(req, res);
        });       
        this.app.get('/api/user/:id',  function(req, res){
            self.onInit();
            return self.userController.GetById(req, res);
        });
    }
開發者ID:ramesh-sharma12,項目名稱:email-client,代碼行數:16,代碼來源:User.ts


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