From 8243a825b36fbf56a78be36cb31ada9c90b12912 Mon Sep 17 00:00:00 2001 From: Steven Kabbes Date: Tue, 27 Aug 2019 07:43:41 -0700 Subject: [PATCH 1/3] Add node10 example --- oss/node-10/.gitignore | 2 ++ oss/node-10/.upignore | 2 ++ oss/node-10/Readme.md | 15 +++++++++++++++ oss/node-10/app.js | 11 +++++++++++ oss/node-10/package.json | 5 +++++ oss/node-10/test.sh | 4 ++++ oss/node-10/up.json | 7 +++++++ oss/node-10/yarn.lock | 7 +++++++ 8 files changed, 53 insertions(+) create mode 100644 oss/node-10/.gitignore create mode 100644 oss/node-10/.upignore create mode 100644 oss/node-10/Readme.md create mode 100644 oss/node-10/app.js create mode 100644 oss/node-10/package.json create mode 100644 oss/node-10/test.sh create mode 100644 oss/node-10/up.json create mode 100644 oss/node-10/yarn.lock diff --git a/oss/node-10/.gitignore b/oss/node-10/.gitignore new file mode 100644 index 0000000..9040e39 --- /dev/null +++ b/oss/node-10/.gitignore @@ -0,0 +1,2 @@ +node_modules +node-v8.9.4-linux-x64 diff --git a/oss/node-10/.upignore b/oss/node-10/.upignore new file mode 100644 index 0000000..7934708 --- /dev/null +++ b/oss/node-10/.upignore @@ -0,0 +1,2 @@ +*.lock +*.md diff --git a/oss/node-10/Readme.md b/oss/node-10/Readme.md new file mode 100644 index 0000000..9127205 --- /dev/null +++ b/oss/node-10/Readme.md @@ -0,0 +1,15 @@ +# Node 10 + +Node 10 application example. + +## Setup + +``` +$ yarn +``` + +## Deploy + +``` +$ up +``` diff --git a/oss/node-10/app.js b/oss/node-10/app.js new file mode 100644 index 0000000..04e9aeb --- /dev/null +++ b/oss/node-10/app.js @@ -0,0 +1,11 @@ +const axios = require('axios') +const http = require('http') + +const { PORT = 3000 } = process.env +const url = 'https://apex.sh' + +http.createServer(async (req, res) => { + const start = Date.now() + await axios.get(url) + res.end(`Response time: ${Date.now() - start}ms\nNode version: ${process.version}`) +}).listen(PORT) diff --git a/oss/node-10/package.json b/oss/node-10/package.json new file mode 100644 index 0000000..8c94cff --- /dev/null +++ b/oss/node-10/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "axios": "^0.18.0" + } +} diff --git a/oss/node-10/test.sh b/oss/node-10/test.sh new file mode 100644 index 0000000..72f63ba --- /dev/null +++ b/oss/node-10/test.sh @@ -0,0 +1,4 @@ +up + +curl -s `up url` +# contains: Response time diff --git a/oss/node-10/up.json b/oss/node-10/up.json new file mode 100644 index 0000000..28d3fa6 --- /dev/null +++ b/oss/node-10/up.json @@ -0,0 +1,7 @@ +{ + "name": "app", + "lambda": { + "runtime": "nodejs10.x", + "memory": 1024 + } +} diff --git a/oss/node-10/yarn.lock b/oss/node-10/yarn.lock new file mode 100644 index 0000000..624d31d --- /dev/null +++ b/oss/node-10/yarn.lock @@ -0,0 +1,7 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +sleep-promise@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/sleep-promise/-/sleep-promise-2.0.0.tgz#e7e798dfe56c044da85882d76d22a99804663c41" From d79d4ea52ebc2442b10de55ba5a6f350f655364f Mon Sep 17 00:00:00 2001 From: Steven Kabbes Date: Tue, 27 Aug 2019 07:52:09 -0700 Subject: [PATCH 2/3] remove nonsense .gitignore --- oss/node-10/.gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/oss/node-10/.gitignore b/oss/node-10/.gitignore index 9040e39..3c3629e 100644 --- a/oss/node-10/.gitignore +++ b/oss/node-10/.gitignore @@ -1,2 +1 @@ node_modules -node-v8.9.4-linux-x64 From babb3d57c33bdc1681580e841c0abcf4d0bcb7d0 Mon Sep 17 00:00:00 2001 From: Steven Kabbes Date: Tue, 27 Aug 2019 08:16:18 -0700 Subject: [PATCH 3/3] update test.sh file to correspond with actual output --- oss/node-10/test.sh | 4 +++- oss/node-10/yarn.lock | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/oss/node-10/test.sh b/oss/node-10/test.sh index 72f63ba..7319a50 100644 --- a/oss/node-10/test.sh +++ b/oss/node-10/test.sh @@ -1,4 +1,6 @@ up curl -s `up url` -# contains: Response time +# contains: +# Response time: XXXms +# Node version: v10.XX.X diff --git a/oss/node-10/yarn.lock b/oss/node-10/yarn.lock index 624d31d..3d097a5 100644 --- a/oss/node-10/yarn.lock +++ b/oss/node-10/yarn.lock @@ -2,6 +2,34 @@ # yarn lockfile v1 -sleep-promise@^2.0.0: +axios@^0.18.0: + version "0.18.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.18.1.tgz#ff3f0de2e7b5d180e757ad98000f1081b87bcea3" + integrity sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g== + dependencies: + follow-redirects "1.5.10" + is-buffer "^2.0.2" + +debug@=3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== + dependencies: + ms "2.0.0" + +follow-redirects@1.5.10: + version "1.5.10" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a" + integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ== + dependencies: + debug "=3.1.0" + +is-buffer@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725" + integrity sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw== + +ms@2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/sleep-promise/-/sleep-promise-2.0.0.tgz#e7e798dfe56c044da85882d76d22a99804663c41" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=