This is my current code. It does not work. I post the image in form data.
My Questions are:
- How can i see the form data in node.js (try log req.body and it is an empty object)
- What does the "demo.jpg" in the code mean?
NODEJS
var aws = require('aws-sdk');
const express = require('express');
const router = express.Router();
aws.config.update({
"accessKeyId": "<MY_KEY>",
"secretAccessKey": "<MY_SECRET>"
});
router.post('/', (req, res, next) => {
console.log(res.body)
var s3 = new aws.S3();
var params = {
Bucket: "passwordapp",
Key: 'aaaaaa',
Expires: 60,
ContentType: 'jpg'
};
s3.getSignedUrl('demo.jpg', params, function(err, data) {
//console.log("err",err);
if (err) {
res.json(err)
} else {
res.json(data)
}
});
});
module.exports = router;