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
- Host: GitHub
- URL: https://github.com/dreesq/serpent-client
- Owner: dreesq
- License: mit
- Created: 2018-10-31T18:43:25.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-18T19:57:22.000Z (almost 2 years ago)
- Last Synced: 2024-12-26T13:17:27.144Z (over 1 year ago)
- Topics: javascript, serpent
- Language: JavaScript
- Homepage: https://dreesq.github.io/serpent
- Size: 1.89 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
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'
});
```