Skip to content

Instantly share code, notes, and snippets.

@furlanf
Last active November 17, 2019 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save furlanf/6c66d0edeb9fbb076fe54cb51f9c79fa to your computer and use it in GitHub Desktop.
Save furlanf/6c66d0edeb9fbb076fe54cb51f9c79fa to your computer and use it in GitHub Desktop.
const createError = require('/opt/node_modules/http-errors');
const middyWrapper = require('/opt/middy-wrapper');
const vegetableCompany= require('/opt/vegetable-company-allowed');
// common-layer/vegetable-company-allowed.js
const products = require('/opt/data/vegetable-products.json');
const handler = async (event, context) => {
try {
return {
'statusCode': 200,
'body': JSON.stringify({
products
})
}
} catch (err) {
console.log(err);
throw new createError.badRequest();
}
};
exports.handler = middyWrapper(handler)
.use(vegetableCompany());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment