Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cloudwatch.incrCount('RestaurantsReturned', restaurants.length);
const response = {
statusCode: 200,
body: html,
headers: {
'content-type': 'text/html; charset=UTF-8'
}
};
callback(null, response);
});
module.exports.handler = wrapper(handler)
.use(ssm({
cache: true,
cacheExpiryInMillis: 3 * 60 * 1000, // 3 mins
setToContext: true,
names: {
restaurants_api: `/bigmouth/${STAGE}/restaurants_api`,
orders_api: `/bigmouth/${STAGE}/orders_api`
}
}))
.use(secretsManager({
cache: true,
cacheExpiryInMillis: 3 * 60 * 1000, // 3 mins
secrets: {
cognito: `/bigmouth/${STAGE}/cognito`
}
}));
Object.keys(exports).forEach(key => {
module.exports[key] = middy(exports[key])
.use(
loggerMiddleware({
logger: log
})
)
.use(
ssm({
cache: true,
names: {
FRONTIER_URL: `/${process.env.STAGE}/frontier/url`
}
})
)
})
}
Object.keys(exports).forEach(key => {
module.exports[key] = middy(exports[key])
.use(
loggerMiddleware({
logger: log
})
)
.use(
ssm({
cache: true,
names: {
FRONTIER_URL: `/${process.env.STAGE}/frontier/url`
}
})
)
})
}
const middy = require('middy')
const { ssm } = require('middy/middlewares')
const handler = async (event, context) => {
let resp = {
foo: process.env.FOO,
bar: process.env.BAR,
jet: process.env.JET,
pack: process.env.PACK,
}
return resp
}
module.exports.handler = middy(handler).use(ssm({
cache: true,
names: {
FOO: 'foo',
BAR: 'bar',
JET: 'jet',
PACK: 'pack',
}
}))
Object.keys(exports).forEach(key => {
const handler = middy(exports[key])
.use(
loggerMiddleware({
logger: log
})
)
.use(httpEventNormalizer())
.use(jsonBodyParser())
.use(cors())
.use(autoProxyResponse())
.use(httpErrorHandler())
if (options.ssmParameters && process.env.SLIC_STAGE !== 'test') {
handler.use(
ssm({
cache: true,
names: options.ssmParameters,
awsSdkOptions: {
endpoint: process.env.SSM_ENDPOINT_URL
}
})
)
}
result[key] = handler
})
return result