Vue-apify
This is a tool for transforming the declaration of REST Api to js object. Inspired by VueRouter, koa2 and axios.
Installation
# Using yarn: yarn add vue-apify# Using npm: npm install vue-apify
Using CDN:
const hook = async { console await } const apiDecl = name: 'user' // Further you'll use it as `api.user()` for sending request // All of the options you'll find https://github.com/mzabriskie/axios#request-config options: ... url: '/user/:id' method: 'get' // You can not call apiMap.settings(), but apiMap.settings.get() will be available name: 'settings' url: '/settings' method: 'get' children: name: 'setStatus' url: '/set_status' method: 'post' name: 'changeAvatar' url: '/change_avatar' method: 'post' const apify = apiDecl axios apify // Global hook is also availableconst api = apify Vue // ... api // ... { this$api // GET: /user/1 // POST: /set_status?status=my_status this$apisettings const avatar = // ... this$apisettings }
Documentations
TODO
- Stacking of paths
- More examples