Delete data
DELETE data
const apiName = 'MyApiName'; // replace this with your api name.const path = '/path'; //replace this with the path you have configured on your APIconst myInit = { headers: {} // OPTIONAL};
API.del(apiName, path, myInit) .then((response) => { // Add your code here }) .catch((error) => { console.log(error.response); });
Example with async/await
async function deleteData() { const apiName = 'MyApiName'; const path = '/path'; const myInit = { headers: {} // OPTIONAL }; return await API.del(apiName, path, myInit);}
deleteData();
Access body in the Lambda function
// using a basic lambda handlerexports.handler = (event, context) => { console.log('body: ', event.body);};
// using serverless expressapp.delete('/myendpoint', function (req, res) { console.log('body: ', req.body);});