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


TypeScript http.HTTP类代码示例

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


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

示例1: init

  public init() {
    let oldest = new Date();
    oldest.setHours(oldest.getHours() - 24);
    let lfRecord = SolarSystems.findOne({_id: '0'});
    if (lfRecord && lfRecord.lastFetch.getTime() > oldest.getTime()) {
      return;
    }

    winston.info('System data is old, refetching...');

    SolarSystems.remove({});
    let res = HTTP.get(CREST_ENDPOINT + 'solarsystems/');
    let data = JSON.parse(res.content);
    for (let item of data['items']) {
      SolarSystems.insert({
        _id: '' + item.id,
        name: item.name,
        name_lower: item.name.toLowerCase(),
      });
    }
    SolarSystems.insert({
      _id: '0',
      name: null,
      name_lower: null,
      lastFetch: new Date(),
    });
  }
开发者ID:paralin,项目名称:evewaitlist,代码行数:27,代码来源:system.ts

示例2: function

 checkTwitter: function (userId: string) {
     check(userId, String);
     this.unblock();
     var result = HTTP.call("GET", "http://api.twitter.com/xyz",
         { params: { user: userId } });
     if (result.statusCode === 200)
         return true
     return false;
 }
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:9,代码来源:meteor-tests.ts

示例3: call

 public call(method: string, uri: string, options: HTTP.HTTPRequest): HTTP.HTTPResponse {
   options.headers = options.headers || {};
   options.headers['Authorization'] = this.options.headers['Authorization'];
   options.headers['Accept'] = this.options.headers['Accept'];
   if (uri.indexOf('http') !== 0) {
     uri = CREST_ENDPOINT + uri;
   }
   return HTTP.call(method, uri, options);
 }
开发者ID:paralin,项目名称:evewaitlist,代码行数:9,代码来源:client.ts

示例4: full_data

export function full_data(id){
    var out = [];
    var url = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=sra&id='+id;
    var result = HTTP.get(url, {timeout:30000});
    if(result.statusCode==200) {
        parseString(result.content,function(err,res){
            if (err) console.log(err);
            else {
                out.push(res);
            }
            //Adding all the important data to the Mongo and showing exporting that to client
            //Meteor.call('insert',res, function(err,re){});
        });

    } else {
        console.log("Response issue: ", result.statusCode);
    }
    //Searches.insert(out);
    return out;
}
开发者ID:bharath-cchmc,项目名称:meteor-geo,代码行数:20,代码来源:fulldata.ts

示例5: full_data

 SRAdata :function(sra){
     //if(sra!="") {
         var id = [];
         var url = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=sra&term=' + sra;
         var result = HTTP.get(url, {timeout: 30000});
         if (result.statusCode == 200) {
             parseString(result.content, function (err, res) {
                 if (err) console.log(err);
                 else {
                     console.log(res.eSearchResult.IdList[0].Id[0]);
                     id.push(res.eSearchResult.IdList[0].Id);
                 }
             });
         } else {
             console.log("Response issue: ", result.statusCode);
         }
         Searches.insert({SRAid: id});
         return full_data(id.join(','));
     //}
 },
开发者ID:bharath-cchmc,项目名称:meteor-geo,代码行数:20,代码来源:main.ts

示例6: function

 HTTP.call('GET',url,{timeout: 50000}, function(err,res){
     if (err) reject(err.reason);
     else{
         var id = [];
         var json = JSON.parse(xmlToJson(res.content));
         if (json.eSearchResult.IdList){
             id.push(json.eSearchResult.IdList.Id)
             var url1='http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=sra&id='+id.join(',');
             HTTP.call('GET',url1,{timeout: 50000}, function(err,result){
                 if (err) reject(err.reason);
                 else{
                     var id2=[]
                     var json2 = JSON.parse(xmlToJson(result.content));
                     id2.push(json2.EXPERIMENT_PACKAGE_SET.EXPERIMENT_PACKAGE)
                     resolve({SRAid:id[0],Record:id2[0]})
                 }
             });
         }
         else(reject('NOTHING AVAILABLE'))
     }
 });
开发者ID:bharath-cchmc,项目名称:sra-interface,代码行数:21,代码来源:sra.ts


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