Skip to content Skip to sidebar Skip to footer

Angular2 Application Call Node.js Function

Ok so I have an Angular2 application running on http://localhost:4200/, Inside this app I'm trying to call a function located in a seperate node.js application currently running on

Solution 1:

You must also add code to handle the OPTIONS request that browsers send for CORS preflights:

app.options('/delete', function(req, res) {
    res.send(200);
});

That addition just causes your Node app send a 200 response with no body with all the necessary Access-Control-* response headers.

Post a Comment for "Angular2 Application Call Node.js Function"