Last active
November 17, 2019 16:04
-
-
Save furlanf/6c66d0edeb9fbb076fe54cb51f9c79fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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