当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Express.get方法代码示例

本文整理汇总了TypeScript中express.Express.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Express.get方法的具体用法?TypeScript Express.get怎么用?TypeScript Express.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在express.Express的用法示例。


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

示例1: getRoutes

    getRoutes()
    {           
        this.app.get('/api/movies', this.moviesController.getRecentlyVisitedMovies)
        this.app.get('/api/imdb', this.moviesController.getImdbMovies);

        this.app.get('/api/imdb/search', this.moviesController.searchImdbMovies);
    }
开发者ID:ramesh-sharma12,项目名称:angular2rc-webpack-workshop,代码行数:7,代码来源:movies.ts

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

示例3: constructor

    constructor(app : Express)
    {   
        app.get('/', function(req, res) {
            res.render('views/index');
        });

        app.get('/home', function(req, res) {
            res.render('views/index');
        });

        app.get('/aboutUs', function(req, res) {
            res.render('views/about');
        });
    }
开发者ID:ramesh-sharma12,项目名称:native-node-todo,代码行数:14,代码来源:index.ts

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

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

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

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

示例8: addListUsers

 private static addListUsers(app: Express) {
   app.get('/api/user/list',
     AuthenticationMWs.authenticate,
     AuthenticationMWs.authorise(UserRoles.Admin),
     UserMWs.listUsers,
     RenderingMWs.renderResult
   );
 }
开发者ID:bpatrik,项目名称:PiGallery2,代码行数:8,代码来源:UserRouter.ts

示例9: addGetStatistic

 private static addGetStatistic(app: Express) {
   app.get('/api/admin/statistic',
     AuthenticationMWs.authenticate,
     AuthenticationMWs.authorise(UserRoles.Admin),
     AdminMWs.loadStatistic,
     RenderingMWs.renderResult
   );
 }
开发者ID:bpatrik,项目名称:PiGallery2,代码行数:8,代码来源:AdminRouter.ts

示例10: addGetDuplicates

 private static addGetDuplicates(app: Express) {
   app.get('/api/admin/duplicates',
     AuthenticationMWs.authenticate,
     AuthenticationMWs.authorise(UserRoles.Admin),
     AdminMWs.getDuplicates,
     RenderingMWs.renderResult
   );
 }
开发者ID:bpatrik,项目名称:PiGallery2,代码行数:8,代码来源:AdminRouter.ts


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