1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/lib/proxy.js

25 lines
473 B
JavaScript
Raw Normal View History

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