dominictarr / JSONStream

rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)
Other
1.92k stars 165 forks source link

reading Json stream #29

Closed pranavs80 closed 11 years ago

pranavs80 commented 11 years ago

Hello,

I was going through your link https://github.com/dominictarr/JSONStream

I also want to read some post data same way you have given example.

My json stream is as http://190.120.229.112/swimapp/test.txt

i will be posting this stream and wanted to read this in node js code.

can u please help me out.

thanks pranav

dominictarr commented 11 years ago

Since this stream is so short, you may as well buffer it and then use JSON.parse, JSONStream is only really useful when the json is a long array, but this is too nested.

pranavs80 commented 11 years ago

ok. but this json stream will be posted from some 3rd party site to my node js code. so how do i read that ?

dominictarr commented 11 years ago

this module is popular: this https://github.com/mikeal/request

dominictarr commented 11 years ago

you mean you will retrive the json with an http request?

pranavs80 commented 11 years ago

yes. i will be running my node js program on for e.g. http://123.123.123.123:3000

so on this link i must be able to read that request.

pranavs80 commented 11 years ago

Thank u very much..

this is the code below to read http request in node js

var express = require('express'); var app = express();

app.configure(function(){ //app.use(express.static(__dirname + '/public')); app.use(express.bodyParser()); });

app.post('/', function(req, res){ console.log(req.body); }app.listen(8001);


u can post any request to your node js program using SEND HTTP TOOL.