INNER CODE UNIT · JavaScript
hello
AnomalyInnovations/serverless-nodejs-starter · handler.js:1
export const hello = async (event, context) => {
return {
statusCode: 200,
body: JSON.stringify({
message: `Go Serverless v2.0! ${(await message({ time: 1, copy: 'Your function executed successfully!'}))}`,
}),
};
};
const message = ({ time, ...rest }) => new Promise((resolve, reject) =>
setTimeout(() => {
resolve(`${rest.copy} (with a delay)`);
}, time * 1000)
);