# vuex-microservice

> Define microservice URLs at a dedicated place and use them inside your Vuex actions.

Latest version **1.0.5** (published 2018-02-06) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install vuex-microservice
pnpm add vuex-microservice
yarn add vuex-microservice
bun add vuex-microservice
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2018-02-06 |
| First published | 2018-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Julian Claus |
| Maintainers | dhjd9m |

## Links

- npm: https://www.npmjs.com/package/vuex-microservice
- Repository: https://github.com/ndabAP/vuex-microservice
- Homepage: https://github.com/ndabAP/vuex-microservice#readme
- Issues: https://github.com/ndabAP/vuex-microservice/issues
- npm.io page: https://npm.io/package/vuex-microservice

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.17.5

## Recent versions

- 1.0.5 (latest) — 2018-02-06
- 1.0.4 — 2018-02-06
- 1.0.3 — 2018-02-06
- 1.0.2 — 2018-02-06
- 1.0.1 — 2018-02-06
- 1.0.0 — 2018-02-06

## README

# vuex-microservice

Define microservice URLs at a dedicated place and use them inside your Vuex actions.

**Warning**: This plugin uses JavaScript's 
[Symbol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol). It's possible that 
your target browser is not supported.

## Features

- One place for your microservice URL
- changes have to be applied only once

## Installation

```bash
$ npm install --save-dev vuex-microservice
```

## Usage

### Prerequisites

The plugin uses [decorators](https://github.com/tc39/proposal-decorators) and Babel. Therefore, you need Babel and a 
Babel plugin to transpile them into native JavaScript.

```bash
$ npm install --save-dev babel-plugin-transform-decorators-legacy
```

Now add the Plugin to your .babelrc.

```json
{
    "plugins": ["transform-decorators-legacy"]
}
```

### Store

First, add the plugin to your Vuex instance. Second, pass the microservice URL as the first argument and the namespace 
where it's used as the second argument.

```js
import { plugin } from 'vuex-microservice'

export default new Vuex.Store({
  plugins: [plugin('http://microservice', 'nested/module')]
  // ... Nested module setup
})
```

Now use the handy decorator to retrieve the microservice URL inside your actions.

```js
import { decorator } from 'vuex-decorator'

export default {
  @decorator('/api/data', 'nested/module')
  action ({state}) {
    const url = state[Symbol.for('nested/module')]
    assert.equal('http://microservice/api/data', url)
  }
}
```

## Author

[Julian Claus](https://www.julian-claus.de) and contributors.

## License

MIT

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