Skip to content

Instantly share code, notes, and snippets.

@fengyfei
Last active April 22, 2019 11:24
Show Gist options
  • Save fengyfei/ea90809a75a9db949ca4f03a8967151d to your computer and use it in GitHub Desktop.
Save fengyfei/ea90809a75a9db949ca4f03a8967151d to your computer and use it in GitHub Desktop.
HttpRequest.getString Sample
// https://github.com/npm/download-counts
import 'dart:html';
const npmDownloadBase = 'https://api.npmjs.org/downloads/point/';
void fetchDownloadCounts({String repo='koa', String period='last-week'}) async {
var resp = await HttpRequest.getString('$npmDownloadBase${period}/$repo');
print(resp);
}
void main() {
fetchDownloadCounts(repo: 'express');
fetchDownloadCounts(repo: 'koa');
fetchDownloadCounts(repo: 'sails');
fetchDownloadCounts(repo: 'hapi');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment