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.
- Host: GitHub
- URL: https://github.com/jhuntdev/blest-vue
- Owner: jhuntdev
- License: mit
- Created: 2023-06-19T16:15:09.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-12-27T17:13:37.000Z (over 1 year ago)
- Last Synced: 2025-09-21T21:36:15.455Z (9 months ago)
- Topics: api, blest, client, vue, vuejs
- Language: TypeScript
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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).