afb-api-js: first step for javascript bindings sandbox/jobol/jsapi
authorJosé Bollo <jose.bollo@iot.bzh>
Wed, 9 Aug 2017 09:07:31 +0000 (11:07 +0200)
committerJose Bollo <jose.bollo@iot.bzh>
Wed, 27 Nov 2019 08:07:37 +0000 (09:07 +0100)
commit7aad83842cdab620e91fe73ac4731d75eb9c283a
treebe6f77125aa10b75cc12d372a8e69c65984bca55
parent9a623c3aa32ec0fbf9682f37a990abd00f38da60
afb-api-js: first step for javascript bindings

Adds the javascript interpreter duktape 2.3.0
for bindings written in javascript.

This is a first integration. Much more work has to be
done for fully providing an interesting feature.

The option --jsapi allows to load a file that
contains javascript. It exports its verbs using

 exports.verbname = function(req, args) ...

where req is the opaque request object and args
is the object representing arguments as returned
by afb_req_json.

The available functions are:
 - require(path) module load (ex system = require("afb:system"))
 - afb_req_success(req, result, info)
 - afb_req_fail(req, status, info)
 - result = afb_req_subcall(req, api, verb, args)

Change-Id: I9e6f14acf3c291ce6a56a1fe88e93afbc4089106
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
.gitignore
CMakeLists.txt
jsapi/js-hello.js [new file with mode: 0644]
src/CMakeLists.txt
src/afb-api-js.c [new file with mode: 0644]
src/afb-api-js.h [new file with mode: 0644]
src/afb-args.c
src/duk_config.h [new file with mode: 0644]
src/duktape.c [new file with mode: 0644]
src/duktape.h [new file with mode: 0644]
src/main-afb-daemon.c