Skip to content

Commit

Permalink
fix: doc
Browse files Browse the repository at this point in the history
  • Loading branch information
rogeriodegoiania committed Apr 21, 2020
1 parent e0b3044 commit 63696b3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,25 @@ Minimalist FaaS framework for [node](http://nodejs.org).
### Example
```javascript
import { WebFaaS } from "@webfaas/webfaas";
import { IMessage, IMessageHeaders } from "@webfaas/webfaas-core";

const faas = new WebFaaS();

(async function(){
await faas.start();

var response = await faas.getCore().invokeAsync("@webfaaslabs/mathsum", "0.0.1", "", [2,3], "npm");

console.log("2 + 3 = ", response);
let msgSum = {} as IMessage;
msgSum.header = {} as IMessageHeaders;
msgSum.header.messageID = "1";
msgSum.header.name = "@webfaaslabs/math";
msgSum.header.method = "sum";
msgSum.header.version = "0.0.1";
msgSum.payload = {x:2,y:3};

let responseSum = await faas.getCore().sendMessage(msgSum);
console.log("2 + 3 = ", responseSum);

await faas.stop();
})();
```

Expand Down

0 comments on commit 63696b3

Please sign in to comment.