The context spec used to get the Amplify server context.
Input for POST operation.
Send a POST request
import { post } from 'aws-amplify/api/server';
//...
const restApiResponse = await runWithAmplifyServerContext({
nextServerContext: { request, response },
operation: async (contextSpec) => {
try {
const { body } = await post(contextSpec, input).response;
return await body.json();
} catch (error) {
console.log(error);
return false;
}
},
});
POST HTTP request (server-side)