
Vue API Query
Elegant and simple way to build requests for REST API
This package helps you quickly to build requests for REST API. Move your logic and backend requests to dedicated classes. Keep your code clean and elegant.
Basic usage
Give me the result for a given criteria, include some entities, append extra fields and order the result
// GET /posts?filter[status]=ACTIVE&include=user,category&append=likes&orderBy=-created_at,category_id
let posts = await Post
.where('status', 'ACTIVE')
.include('user', 'category')
.append('likes')
.orderBy('-created_at', 'category_id')
.get()
Just give me the first occurrence from response:
// GET /posts?filter[status]=ACTIVE
let post = await Post
.where('status', 'ACTIVE')
.first()
Nice! Now I want a specific object:
// GET /posts/1
let post = await Post.find(1)
Edit this and send it back:
// PUT /posts/1
post.title = 'Awsome!'
post.save()
Ops, delete it!
// DELETE /posts/1
post.delete()




