aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Tuomi <jan.tuomi@eficode.com>2018-07-12 12:26:10 +0300
committerJan Tuomi <jan.tuomi@eficode.com>2018-07-12 12:26:10 +0300
commit6700bb48e52a2f7873e700d94270c96c300c1969 (patch)
tree11d6d88465ec58b367d127721fcd6a4a448768ee
parent33fc72e5ce47a0669072d173e6f95e6e3661f516 (diff)
Add README.md
-rw-r--r--README.md54
1 files changed, 54 insertions, 0 deletions
diff --git a/README.md b/README.md
index e69de29..9df5bdf 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,54 @@
+# faaslift
+
+Small Function as a Service (FaaS) server built with Node.js and MongoDB. Useful for deploying quick endpoint prototypes to your own server.
+
+# Setup
+
+## Server
+
+Clone the repository to your server.
+Create a file called `.env` in the project directory and add the following fields:
+
+```
+MONGODB_URL=<YOUR MONGO URL WITH AUTH>
+PORT=<YOUR FAVOURITE HTTP PORT>
+```
+
+A great place to host the Mongo instance is https://mlab.com/.
+
+Start the server with your favourite production grade Node.js runner, e.g. `pm2`.
+
+```
+pm2 start index.js --name faaslift
+```
+
+## Client
+
+Install the package globally with npm.
+
+```
+npm i -g faaslift
+```
+
+Run faaslift with `faaslift`. Authorize the CLI with the `authorize <MONGO URL>` command (same URL as on the server).
+
+Create a new endpoint with `create <name>`. Your endpoint is now live at http://your-server/name.
+
+Use `upload <file> <endpoint>` to upload a file from your current working directory to an endpoint. Below is an example of such a file.
+
+```
+module.exports = function (req, res) {
+ res.type('text/html');
+ res.send(<h1>Hello world!</h1>');
+};
+```
+
+`req` and `res` are Express objects.
+
+# Security
+
+The functions are *NOT* containerized in any way! This means that code running at an endpoint is e.g. able to crash the server or manipulate other endpoints, among other evil deeds, with a little bit of tinkering. That's why this project is solely meant for prototyping purposes.
+
+# Author
+
+Jan Tuomi <jans.tuomi@gmail.com>, 2018