Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let aws = require('aws-sdk');
- let simpledb = new aws.SimpleDB({
- region: 'US-East',
- endpoint: 'https://sdb.amazonaws.com'
- });
- exports.handler = async (event) => {
- let saved_coffees = {};
- let response;
- console.log('request ' + JSON.stringify(event));
- // Handle POST request incoming
- if(event.body !== null && event.body !== undefined) {
- // Probably a post request?
- // Save our coffees
- console.log('saw a post mabye', event.body)
- saved_coffees = JSON.parse(event.body);
- response = {
- statusCode: 200,
- body: 'Coffees saved',
- };
- } else {
- // probably a GET?
- console.log('saw a get, maybe')
- response = {
- statusCode: 200,
- body: JSON.stringify(saved_coffees)
- }
- }
- return response;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement