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

https://github.com/jhuntdev/blest-vue

A Vue client for BLEST (Batch-able, Lightweight, Encrypted State Transfer), an improved communication protocol for web APIs which leverages JSON, supports request batching by default, and provides a modern alternative to REST.
https://github.com/jhuntdev/blest-vue

api blest client vue vuejs

Last synced: 4 months ago
JSON representation

A Vue client for BLEST (Batch-able, Lightweight, Encrypted State Transfer), an improved communication protocol for web APIs which leverages JSON, supports request batching by default, and provides a modern alternative to REST.

Awesome Lists containing this project

README

          

# BLEST Vue

A Vue client for BLEST (Batch-able, Lightweight, Encrypted State Transfer), an improved communication protocol for web APIs which leverages JSON, supports request batching by default, and provides a modern alternative to REST.

To learn more about BLEST, please visit the website: https://blest.jhunt.dev

## Features

- Built on JSON - Reduce parsing time and overhead
- Request Batching - Save bandwidth and reduce load times
- Compact Payloads - Save even more bandwidth
- Single Endpoint - Reduce complexity and facilitate introspection
- Fully Encrypted - Improve data privacy

## Installation

Install BLEST Vue from npm

With npm:
```bash
npm install --save blest-vue
```
or using yarn:
```bash
yarn add blest-vue
```

## Usage

Wrap your app (or just part of it) with `BlestProvider`.

```html



import { BlestProvider } from 'blest-vue'
export default {
data() {
return {
};
},
mounted() {
},
methods: {
},
};

```

Use the `blestRequest` function to perform passive requests on mount and when parameters change.

```html


Loading...


Error: {{ error.message }}


{{ JSON.stringify(data) }}


import { blestRequest } from 'blest-vue'
export default {
setup() {
const { data, error, loading } = blestRequest('listItems', { limit: 24 }, { select: ['edges', ['pageInfo', ['endCursor', 'hasNextPage']]] })

return { data, error, loading }
}
};

```

Use the `blestCommand` function to generate a request function you can call when needed.

```html



Submit

Loading...


Error: {{ error.message }}


{{ JSON.stringify(data) }}


import { blestLazyRequest } from 'blest-vue'
export default {
setup() {
const [submitForm, { data, loading, error }] = blestLazyRequest('submitForm')

const handleSubmit = () => {
submitForm({
hello: 'World'
})
}

return { handleSubmit, data, loading, error }
}
};

```

## License

This project is licensed under the [MIT License](LICENSE).