Require packages to be downloaded >= 100x/day

This should make it more difficult for people who are publishing
malicious packages to npm to get them on the CDN.
This commit is contained in:
MICHAEL JACKSON
2017-08-16 22:47:24 -07:00
parent 666d8afc95
commit 1173f91091
9 changed files with 148 additions and 37 deletions

17
server/NPMAPI.js Normal file
View File

@ -0,0 +1,17 @@
require('isomorphic-fetch')
const NPMAPIURL = 'https://api.npmjs.org'
function getJSON(path) {
return fetch(`${NPMAPIURL}${path}`, {
headers: {
Accept: 'application/json'
}
}).then(function (res) {
return res.status === 404 ? null : res.json()
})
}
module.exports = {
getJSON
}