var request = require('superagent');
var url = 'api/server';
request.put(url)
.set('Content-Type', 'application/json')
.send('{"name":"tj","pet":"tobi"}')
.end(function(err, res){
if (err) throw err;
console.log(res.text);
});
above is the code that i use for upload data. If I change put into post, it's not working. I don't know why is that, can anyone help?
Also, actually I want to upload a file. But I cannot use put with .attach('theFile', file)
. I've search a lot of example but none of them work for me.