Light-weight examples for HelloWorld - for on reading an input/request.

This commit is contained in:
Alex
2017-04-09 19:36:45 +01:00
parent 1b1af023c4
commit 8ec31d9b89
12 changed files with 147 additions and 0 deletions

View File

@ -0,0 +1,18 @@
FROM node:6.9.1-alpine
ADD https://github.com/alexellis/faas/releases/download/0.5.1-alpha/fwatchdog /usr/bin
RUN chmod +x /usr/bin/fwatchdog
WORKDIR /root/
COPY package.json .
RUN npm i
COPY handler.js .
ENV fprocess="node handler.js"
HEALTHCHECK --interval=1s CMD [ -e /tmp/.lock ] || exit 1
CMD ["fwatchdog"]

View File

@ -0,0 +1,5 @@
#!/bin/sh
echo "Building functions/node:6.9.1-alpine"
docker build -t functions/node:6.9.1-alpine .

View File

@ -0,0 +1,15 @@
"use strict"
let getStdin = require('get-stdin');
let handler = require('./handler');
let handle = (req) => {
console.log(req);
};
getStdin().then(val => {
handle(val);
}).catch(e => {
console.error(e.stack);
});

View File

@ -0,0 +1,15 @@
{
"name": "NodejsBase",
"version": "1.0.0",
"description": "",
"main": "faas_index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"get-stdin": "^5.0.1"
}
}