I am currently sending a request from NodeJS to get some data, as such :
In Angular :
$http.post(API_ENDPOINT.url + '/annonce', {'link': url}).then(function (result) {
...
}
And in Node :
apiRoutes.post('/annonce', function (req, res) {
const url = req.body.link
request.get({
uri: url,
encoding: null
}, function (error, response, html) {
if (!error) {
res.send(parser(url, html))
}
})
return res
})
I would like to send this request from my front-end (Angular). I guess I could simply do the request like this :
$http.get(url).then(function(result)) {
// send another post request to the back end with the result
}
but I've heard it was easier to use pipes in this case. Thing is, I really don't understand how to make it work. Can anyone help ?
via mtefi
No comments:
Post a Comment