Skip to content

metacall/express-faas-rpc-example

Repository files navigation

MetaCall Express FaaS RPC Example

An example of building a FaaS server with NodeJS and Express, with a client based on RPC Loader.

Architecture

This example shows how to implement a server offering FaaS facilities by using MetaCall with NodeJS, the RPC calls from client look like normal function calls.

Run it

  1. Install MetaCall:

    curl -sL https://raw.githubusercontent.com/metacall/install/master/install.sh | sh
  2. Install dependencies:

    metacall npm install
  3. In a terminal, run:

    $ metacall
    λ load node server.js
  4. In another terminal, run:

    metacall client.js

    Or optionally, with CURL:

    curl -X POST -H 'Content-type: application/json' http://localhost:3051/call/sum --data '[3, 4]'
    curl -X POST -H 'Content-type: application/json' http://localhost:3051/call/mult --data '[2, 3]'
  5. In order to close it, in the server terminal write:

    λ call close()
    λ exit

Releases

No releases published

Packages

No packages published