0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-30 22:34:10 -05:00
verdaccio/lib/proxy.js

25 lines
473 B
JavaScript
Raw Normal View History

2013-05-31 20:06:36 -05:00
var https = require('https');
2013-05-31 01:26:11 -05:00
module.exports.request = function(req, resp) {
2013-05-31 20:06:36 -05:00
https.get({
2013-05-31 01:26:11 -05:00
host: 'registry.npmjs.org',
path: req.url,
2013-05-31 20:06:36 -05:00
ca: require('./npmsslkeys'),
2013-05-31 01:26:11 -05:00
headers: {
2013-06-07 20:16:28 -05:00
'User-Agent': 'sinopia/0.0.0',
2013-05-31 01:26:11 -05:00
},
}, 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);
});
}