An open API service indexing awesome lists of open source software.

https://github.com/dreesq/serpent-client

Client library for Serpent containing plugins for actions, authentication, validation and communication with the server component
https://github.com/dreesq/serpent-client

javascript serpent

Last synced: about 1 year ago
JSON representation

Client library for Serpent containing plugins for actions, authentication, validation and communication with the server component

Awesome Lists containing this project

README

          



Client component of the Serpent ecosystem. You may read more in our [documentation](https://dreesq.github.io/serpent/#/client/introduction).

# Setup

```
npm install @dreesq/serpent-client
```

#### Separate dependencies
These dependencies are passed in client constructor
```
npm i axios socket.io-client
```

# Usage

Basic client instantiation

```js
import Serpent from '@dreesq/serpent-client'
import axios from 'axios';

const client = new Serpent({
debug: true,
axios,
handler: 'https://localhost:3000/o',
actions: 'https://localhost:3000/o'
});

await client.setup();

// Assuming there's an action defined with {name: 'hello'}
const {data, errors} = await client.hello({
name: 'World'
});
```