Skip to content

Commit

Permalink
Fix the client example and code hl
Browse files Browse the repository at this point in the history
  • Loading branch information
bas080 committed May 6, 2023
1 parent f6a62a3 commit a105dbd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
36 changes: 20 additions & 16 deletions README.mz
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,33 @@ operations in a single request.
## Usage

```bash
npx furver ./example/api.mjs --port=4040
npx furver ./example/api.mjs
```

And it comes with a client that has functions that directly map to the
functions in the provided module.
Furver includes a client with functions that correspond to those in the module.
Plus, it handles bulk requests for you, combining sequential calls into
a single POST request.

```js cat ./example/client.mjs
```
```js node
(async function() {

```node node ./example/client.mjs
```
const { default: FurverClient } = await import('./client.mjs')

const api = await FurverClient({endpoint: `http://localhost:${process.env.PORT}`})

It also automatically performs bulk requests for you. These three function
calls result in a single POST request.
console.log(await Promise.all([
api.identity('hello world'),
api.timestamp(),
api.version()
]))

})()
```

```bash bash
furver --help
```

## HTTP Frameworks

You might be using a (popular) HTTP framework. Furver should support your
framework. If not, it should be trivial to implement.

> Open for **contributors**.

## Schema

For debugging or other reasons it is possible to get the schema using the
Expand All @@ -48,6 +49,9 @@ For debugging or other reasons it is possible to get the schema using the
furver --schema ./example/api.mjs
```

> Generating the schema and passing it as an object to the client removes the
> need to fetch the schema from the server and readies the client for requests.

## Security

Furver provides a "deep freeze" mechanism to prevent the object exported by the
Expand Down
9 changes: 0 additions & 9 deletions example/client.mjs

This file was deleted.

0 comments on commit a105dbd

Please sign in to comment.