# @apichef/vue-resource

> REST API request builder for Vue.js

Latest version **0.0.3** (published 2020-03-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @apichef/vue-resource
pnpm add @apichef/vue-resource
yarn add @apichef/vue-resource
bun add @apichef/vue-resource
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2020-03-26 |
| First published | 2020-02-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Milroy E. Fraser |
| Maintainers | milroy.me |
| Keywords | vue, rest, api |

## Links

- npm: https://www.npmjs.com/package/@apichef/vue-resource
- Repository: https://github.com/apichef/vue-resource
- Homepage: https://github.com/apichef/vue-resource#readme
- Issues: https://github.com/apichef/vue-resource/issues
- npm.io page: https://npm.io/package/@apichef/vue-resource

## Dependencies (1)

- [@apichef/request-builder](https://npm.io/package/@apichef/request-builder.md) ^0.0.7

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2020-03-26
- 0.0.2 — 2020-03-25
- 0.0.1 — 2020-02-18

## README

![build](https://github.com/apichef/vue-resource/workflows/build/badge.svg)

# REST API request builder for Vue.js

## Install

Via yarn

``` bash
$ yarn add @apichef/vue-resource
```

Via npm

``` bash
$ npm install @apichef/vue-resource
```

## Basic usage

```js
import Vue from "vue"
import { VueResource } from "@apichef/vue-resource"
import axios from "axios"

const request = (config) => {
    return axios.request({
        ...config,
        baseURL: 'http://example.com/api/'
    })
}

const nameResolver = resource => resource.type

Vue.use(VueResource, { request, nameResolver })

// in your component

export default {
    data() {
        return {
            projects: []
        }
    },

    async created() {
        await this.fetchProjects()
        // do something
    },

    methods: {
        async fetchProjects() {
            const response = await this.$resource('projects')
                .with([
                    'languages',
                    'subjects',
                ])
                .all()

            this.projects = response.data
        }
    }
}
```

## Testing

``` bash
$ npm run test
```

## Security

If you discover any security related issues, please email milroy@outlook.com instead of using the issue tracker.

## Credits

- [Milroy E. Fraser][link-author]
- [All Contributors][link-contributors]

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[link-author]: https://github.com/milroyfraser
[link-contributors]: ../../contributors

---
_Source: https://npm.io/package/@apichef/vue-resource · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
