Skip to content

Commit e102c29

Browse files
committed
initial commit for Node.js layer example
1 parent 1df6ab7 commit e102c29

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import _ from "lodash"
2+
3+
export const handler = async (event) => {
4+
5+
var users = [
6+
{ 'user': 'Carlos', 'active': true },
7+
{ 'user': 'Gil-dong', 'active': false },
8+
{ 'user': 'Pat', 'active': false }
9+
];
10+
11+
let out = _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
12+
const response = {
13+
statusCode: 200,
14+
body: JSON.stringify(out + ", " + users[out].user),
15+
};
16+
return response;
17+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"statusCode": 200,
3+
"body": "\"2, Pat\""
4+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm install .
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mkdir -p nodejs/node20
2+
cp -r node_modules nodejs/node20/
3+
zip -r layer_content.zip nodejs
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "layer",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"scripts": {
6+
"test": "echo \"Error: no test specified\" && exit 1"
7+
},
8+
"author": "",
9+
"license": "MIT-0",
10+
"description": "",
11+
"dependencies": {
12+
"lodash": "4.17.21"
13+
}
14+
}

0 commit comments

Comments
 (0)