Hello zladuric,
Thank you for your inputs. I know my webserver.js (which is my nodejs file)
is incomplete. I have just included method stubs that needs to be
developed.
Alright, let me explain what i am trying to do.
I am developing an application that queries mysql database (that
gets updated realtime) whenever
there is a http request and draws a chart with the data.
Basically i am POPULATING DATA USING SERVER
SIDE CODE. I found a sample in php which works fine for small
database. But it fails for large databases.
The chart displays nothing for large data. So i am trying to
create a nodejs(asynchronous) which is the solution.
Can you make the changes in the webserver.js file and post it here. That
would be of great help to any beginner here. Thanks again
On Thursday, November 20, 2014 1:30:45 PM UTC+5:30, zladuric wrote:
>
> 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/1eef451a-543e-4b64-9bf9-a2675a96864f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.