node.js - Parse request with JSON.parse -


I try to parse a request with node.js , then next I I create:

  app.get ('/ download', function (request, race) {var parseJSON = JSON.parse (request); on file = parseJson.fileName; res. Set the file; // set and send it.});   

And I send a request with the Advanced Rest client:

URL: http: // localhost: 5000 / download

method: received

raw logic: fileinfo: "C: //1//239698_n.jpg"

And this gives me the next error:

  Syntax error: Unexpected token at o port at Object.parse (native) (c: \ node \ NodeJS \ express.js: 13: 24) On the callback (c: \ node \ NodeJS \ node_modules \ express \ lib \ router \ index.js: 164: 37) on the ultimate (c: \ node \ NodeJS \ node_modules \ express \ lib \ router \ index.js: 138: 11) near (c: \ n D \ NodeJS \ node_modules \ express \ lib \ router \ index.js: 145: 5) Router._dispatch (minus c: \ node \ NodeJS \ node_modules \ \ lib \ router \ index. Js: 173: 5 ) Object.router (less than c: \ node \ NodeJS \ node_modules \ express \ lib \ router \ index.js: 33: 10)   

What can be reson?

You are not sending JSON. You are sending query string formatted logic. Whether you want to use or, shameless plug alerts, my modules, which format is atheist.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -