0.25.0 • Published 6 years ago

functions-io v0.25.0

Weekly downloads
6
License
MIT
Repository
github
Last release
6 years ago

Functions-IO

FaaS Micro Framework

work in progress...

Minimalist FaaS framework for node.

Features

  • Focus on high performance
  • Input/Output with automatic validation
  • Openapi/Swagger definition generated automatically

Installation

$ npm install functions-io

Usage

Create a subfolder in functions folder and generate package.json

$ npm init

example package.json

{
  "name": "sum",
  "version": "1.0.0",
  "description": "sum x + y",
  "main": "index.js"
}

create file index.js

module.input = {
    x:{type:"integer", required:true},
    y:{type:"integer", required:true}
};
module.output = {
    value:{type:"integer"}
};

module.exports = function(context, message, callBack){
    callBack(null, {value: message.x + message.y});
};

Start Server

var functionsio = require("functions-io");
var app = functionsio();

app.listen(8080);

swagger.json

http://localhost:8080/swagger.json

Catalog API (Openapi / Swagger)

http://localhost:8080/_admin/catalog

Admin

http://localhost:8080/_admin/stats

Test

http://localhost:8080/_admin/test

Options property

  • path (default: functions)
  • enableStatistics (default: true)
  • enableSecurity (default: false)
  • test
    • load (default: true)
    • executeOnStart (default: false)
  • scan
    • automatic (default: true)
    • interval (default: 2000)
  • cors
    • enable (default: false)
    • fromOrigin (default: *)
  • html
    • static (default: static)
  • db
    • provider (default: sys.db.provider.mongo)
  • functions
    • sys.db.provider.mongo
      • db
        • url (default: mongodb://localhost:27017/sample)
//example
var functionsio = require("functions-io");
var app = functionsio();

app.listen(8080);
  • example file config.json
{
    "functions":{
        "sys.db.provider.mongo":{
            "db":{
                "url":"mongodb://localhost:27017/sample"
            }
        }
    }
}
  • example file config.json
{
    "unitTest":{
        "load": true,
        "executeOnStart": false
    },
    "functions":{
        "sys.db.provider.mongo":{
            "db":{
                "url":"mongodb://localhost:27017/sample"
            }
        }
    }
}
  • example file config.json
{
    "scan":{
        "automatic": true
    },
    "unitTest":{
        "load": true,
        "executeOnStart": false
    },
    "functions":{
        "sys.db.provider.mongo":{
            "db":{
                "url":"mongodb://localhost:27017/sample"
            }
        }
    }
}
  • example file config.json
{
    "scan":{
        "automatic": true
    },
    "unitTest":{
        "load": true,
        "executeOnStart": false
    },
    "global":{
        "db":{
            "provider":"sys.db.provider.myprovider"
        }
    }
}

curl -XPOST http://localhost:8080 -H "content-type:application/json" -d '{"jsonrpc":"2.0","method":"security.login","params": {"email":"admin@admin.com", "password":"123"} }' -v

curl -XPOST http://localhost:8080 -H "content-type:application/json" -H "authorization:bearer " -d '{"jsonrpc":"2.0","scope":"functions-io-labs","method":"math.sum","version":"2.0.0","params": 2,4}' -v

0.25.0

6 years ago

0.24.0

6 years ago

0.23.0

6 years ago

0.21.0

6 years ago

0.20.0

6 years ago

0.19.0

6 years ago

0.17.0

6 years ago

0.16.0

6 years ago

0.15.0

6 years ago

0.14.0

6 years ago

0.13.0

6 years ago

0.12.0

6 years ago

0.9.0

6 years ago

0.7.14

8 years ago

0.7.13

8 years ago

0.7.12

8 years ago

0.7.10

8 years ago

0.7.9

8 years ago

0.7.8

8 years ago

0.7.7

8 years ago

0.7.6

8 years ago

0.7.5

8 years ago

0.7.4

8 years ago

0.7.3

8 years ago

0.7.2

8 years ago

0.7.1

8 years ago

0.6.24

8 years ago

0.6.23

8 years ago

0.6.22

8 years ago

0.6.21

8 years ago

0.6.20

8 years ago

0.6.19

8 years ago

0.6.18

8 years ago

0.6.16

8 years ago

0.6.15

8 years ago

0.6.14

8 years ago

0.6.13

8 years ago

0.6.12

8 years ago

0.6.11

8 years ago

0.6.10

8 years ago

0.6.9

8 years ago

0.6.6

8 years ago

0.6.5

8 years ago

0.6.4

8 years ago

0.6.3

8 years ago

0.6.2

8 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.4.2

8 years ago

0.4.0

8 years ago

0.3.5

8 years ago

0.3.4

8 years ago

0.3.3

8 years ago

0.3.1

8 years ago