0
Ich versuche, externe API mit Request-Modul aufrufen, es funktioniert ordnungsgemäß, wenn ich lokal gehosteten API aufgerufen, aber keinen Erfolg beim Aufruf externer API. Hinweis: Ich hinter Proxy bin, die das Problem sein kannAufruf von externen REST-API hinter Proxy mit Request-Modul
-Code
app.get('/Get', function(req, res){
request.get('https://api.github.com/repos/request/request',
function(error, response, body) {
if (!error && response.statusCode === 200) {
res.send(response.body);}
else {
res.json(error);
}
});
});
app.listen(8080);
console.log("server is running at 8080");
Es funktioniert einwandfrei, wenn ich als Gebrüll lokale API Aufruf bin:
request.get('http://localhost:8080/hello',