node.js - Parse request with JSON.parse -
I try to parse a request with And I send a request with the Advanced Rest client: URL: method: raw logic: And this gives me the next error: 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. 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.});
http: // localhost: 5000 / download
received
fileinfo: "C: //1//239698_n.jpg"
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)
Comments
Post a Comment