Skip to content

Latest commit

 

History

History
34 lines (29 loc) · 1.21 KB

README.md

File metadata and controls

34 lines (29 loc) · 1.21 KB

Build Status Coverage Status Dependency Status devDependency Status

#lambda-rpc

Example usage

import LambdaRpc from "lambda-rpc";
import {exec} from "child_process";

var lambdaRpc = new LambdaRpc()
    .methods({
        cowSay: function (message) {
            return new Promise(function (resolve, reject) {
                exec(`cowsay ${message}`, function (err, stdout) {
                    if (err) {
                        reject(err);
                    } else {
                        resolve(stdout);
                    }
                });
            });        }
    })
    .methods({
        echo: function (message) {
            return message;
        }
    });

export var handler = lambdaRpc.getRouter();