本文整理汇总了TypeScript中meteor/http.HTTP.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript HTTP.get方法的具体用法?TypeScript HTTP.get怎么用?TypeScript HTTP.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meteor/http.HTTP
的用法示例。
在下文中一共展示了HTTP.get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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(),
});
}
示例2: 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;
}
示例3: 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(','));
//}
},