Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 601 Bytes

README.md

File metadata and controls

35 lines (23 loc) · 601 Bytes

OgJs

Is a set of libraries in for JavaScript to interact with API's as resources and collections.

But, what?

// You can turn this
const data = {
 name: 'John'
}

const user = axios.post('/api/path', data)


// Into this

const user = new User(api, { name: 'John' })

user.save();
// Also you can query like this:
const user = new User(api, { name: 'John', email: '[email protected]' });

user.where('email', '[email protected]').find();

// Or fail if negative response
try {
   user.findOrFail();
 } catch() {
   console.log(user.response.message);
 }