Hi,
Where is your render ? I think the good place would be in the 'end' event
of your res var. Else, at the tick of your render, you don't have the
result of your request.
Regards,
Gaël
Le mercredi 27 avril 2016 17:05:43 UTC+2, Sirine Ibn Fraj a écrit :
>
> Hello everyone ,
>
> I am trying to retrieve data from a REST API in the server side (*.js) and
> display it in my view (*.jade)
>
>
> I was able to get the data but was not able to send it to the view .
> This is how my code looks like :
>
>
> var reqGet = https.request(optionsget, function(res) {
> console.log("statusCode: ", res.statusCode);
> res.on('data', function(d) {
> console.info('GET result:\n');
>
> BugData =d ;
> console.log(d);
>
> });
>
> });
>
> reqGet.end();
>
>
> BugData (was defined before )is the variable i am trying to send to the
> view but for some reasons it is empty and does not contain the variable 'd'
>
>
> Does anyone know why or how can i solve this ?
> Thanks
>
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/3220993c-2eed-4a75-a0e1-edfd2f977261%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.