Sending an Email Parameter with Amplify API GET Request

Photo by Taylor Vick on Unsplash

Scenario

Approach

async getCustomer() {let params = {
'queryStringParameters':
{
email: 'alyssa@gmail.com'
}
}
const customer = await API.get('customerapi', '/customers', params)
console.log(customer)}
app.get("/customers", function(req, res) {
const email = req.query.email
res.json(
{
data: 'Hi There Cuz!',
email
});
}

Bonus

async createCustomer(email: string) {let params = {
body: {
email
},
headers: {} // OPTIONAL
}
return API.post('customerapi', '/customers', params)
}
app.post("/customers", function(req, res) {
const email = req.body.email;
res.json(
{
data: 'Hi There Cuz!',
email
});
});

Brought to You By Firefly Semantics

Founder of Firefly Semantics Corporation