Monday, 22 May 2017

cURL params in node.js

I am using express w/ bodyParser

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
    extended: true
}));

I am sending a cURL reuqest with a test key and test image.. I ws told to use -F instead of -d

curl -i -X POST -F image=@image.png -F key=test http://localhost:3000/api/photos/

am attempting to extract the params.. but I cannot get either. I have tried with no luck:

console.log(request)
console.log(request.query)
console.log(request.params)
console.log(request.body)

any help appreciated



via MattEm

No comments:

Post a Comment