mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-30 22:34:10 -05:00
25 lines
514 B
JavaScript
25 lines
514 B
JavaScript
var http = require('http');
|
|
|
|
module.exports.request = function(req, resp) {
|
|
console.log(req.headers);
|
|
http.get({
|
|
host: 'registry.npmjs.org',
|
|
path: req.url,
|
|
headers: {
|
|
'User-Agent': 'npmrepod/0.0.0',
|
|
'Authorization': req.headers.authorization,
|
|
},
|
|
}, 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);
|
|
});
|
|
}
|
|
|