mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-13 03:35:52 +01:00
25 lines
473 B
JavaScript
25 lines
473 B
JavaScript
var https = require('https');
|
|
|
|
module.exports.request = function(req, resp) {
|
|
https.get({
|
|
host: 'registry.npmjs.org',
|
|
path: req.url,
|
|
ca: require('./npmsslkeys'),
|
|
headers: {
|
|
'User-Agent': 'sinopia/0.0.0',
|
|
},
|
|
}, function(res) {
|
|
resp.writeHead(res.statusCode, res.headers);
|
|
res.on('data', function(d) {
|
|
resp.write(d);
|
|
});
|
|
res.on('end', function() {
|
|
resp.end();
|
|
});
|
|
}).on('error', function(err) {
|
|
console.error(err);
|
|
resp.send(500);
|
|
});
|
|
}
|
|
|