AngularJS + ExpressJS. Proxy-POST-Anforderung ist anhängig

Mit AngularJS + Express
Ich habe den folgenden code, um einen proxy für meine Anforderungen an eine remote-service:

app.get('/api.json', function (req, res) {
    req.pipe(request("http://test-api.com/api.json")).pipe(res);
});

app.post('/api.json', function (req, res) {
    req.pipe(request.post("http://test-api.com/api.json")).pipe(res);
});

Alle Anforderungen, funktioniert einwandfrei, jedoch ist die POST Anfragen sind noch in meinem browser.

Hier ist, wie ich post:

$http({
   method: 'POST',
   url: '/api.json',
   data: $.param({
       "title": not.title,
       "desc": not.description
  }),  //pass in data as strings
   headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function () {alert("Success");});

Was ist falsch?

EDIT:
Hier ist die Anfrage, wie man auf der console:
AngularJS + ExpressJS. Proxy-POST-Anforderung ist anhängig

Was sollte ich prüfen, um mehr Informationen?

  • Die URLs nicht übereinstimmen: der client sendet zu /notifications.json, in der Erwägung, dass die server-codes verarbeitet /api.json
  • Nur ein Tippfehler ... eidted
  • wenn es ansteht, das Rohr zu request.post ist nicht, dass etwas zurückgegeben oder nie erreicht wird. wenn der stream nie fortgesetzt wird, wird die Antwort nie geschrieben werden, um die res
  • Danke für die Antwort, aber wenn ich vom client (via Formular) direkt an die API, bekomme ich sofort eine Antwort
  • Irgendwelche neuen Ideen? Ich bin VERLOREN 🙁
  • Was bedeutet die post-Anforderung Aussehen in Ihre Konsole, wenn Sie es tun, aus einem Formular?

Schreibe einen Kommentar