@agog/apix
v0.0.5-beta.2
Published
Automatically generate your VUEX store using your REST endpoints
Downloads
14
Readme
API-X
Automatically generate your VUEX store using your REST endpoints
Getting Started
Apix runs best on a web application powered by Vue js and Vuex
Internally, apix uses axios to send HTTP requests.
Installing
Using npm
$ npm i @agog/apix
Usage
You can then import and use the apix store generator in your files using the example below
import Vue from 'vue';
import Vuex from 'vuex';
import Apix from '@agog/apix';
Vue.use(Vuex);
let apix = new Apix({
prefix: '/api/v1',
headers: {},
resources: [
{ name: 'marvelHeroes', url: 'marvel-heroes' }
],
});
export const store = new Vuex.Store({
state: {
...apix.getState(),
},
getters: {
...apix.getGetters(),
},
mutations: {
...apix.getMutations(),
},
actions: {
...apix.getActions(),
},
});
Configurations
The apix object constructor accepts an object as a parameter that must contain the resources array of objects, an optional prefix for versioning and optional headers that will be passed to axios internally
Running the tests
In order to run the tests run the following command in the root of the application
npm test