Vasa,
It seems your webserver.js is incomplete? Either that or you forgot to call
res.end() in there.
>From what I see, you read file names the database? Then read those files?
What do you want to do with them? Let's say you just want to respond with a
JSON of the files you found in the directories you queried.
You'd have to make a few changes to webserver.js.
1. in your request handler, you have an `if(err){return;}` block. You
should do something like `if(err) { res.status(500); res.end(err);}`. That
would close the request (that is still waiting for you to end it after you
went to the database).
2. After that if block, you should do something with results. Like,
res.json(files);. That would send back the response as content-type
application/json and end the request.
Hope that helps.
On Wednesday, November 19, 2014 7:35:12 AM UTC+1, Vasa wrote:
>
> Hello Aria,
>
> Thank you for pointing out the bug. I am new to PHP :). I fixed it and my
> PHP is working fine retrieving the data and charting.
> But i am trying to move the db queries to my nodejs. So that when a
> request is made, it queries the db and then tries to chart the data.
> I have attached my node server. Please help me out.
>
>
> On Tuesday, November 18, 2014 1:21:53 PM UTC+5:30, Vasa wrote:
>>
>> Hello noders
>>
>> i am trying to generate a chart (using highcharts) with queried data from
>> Mysql.
>> I have my data.php file to query the database and create a JSON file.
>> This JSON file is used by index.php file to draw the chart.
>> This is not working because the chart is drawn before the sql data is
>> retrieved.
>>
>> I am trying to create a nodejs for the same and i assume this is the
>> solution to my requirement
>>
>> Any advice here
>>
>>
>>
>>
>>
--
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/91248b7e-31ef-4d14-a649-961db80848b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.