Skip to content

yucom-util/rest-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rest-client

import { connect } from '@yucom/rest-client';

const client = connect('http://localhost:8989');

const john = await client.get.people[123]();  // GET /people/123

const phones = await client.list.people[123].phones({type: 'mobile'});  // GET /people/123/phones?type=mobile

const john = await client.create.people({ name: 'John', lastname: 'Connor' }); // POST /people {"name":"John","lastname":"Connor"}

const john = await client.update.people[123]({ age: 27 }); // PATCH /people/123 {"age":27}

const john = await client.replace.people[123]({ name: 'Carl', lastname: 'Connor' });  // PUT /people/123 {"name":"John","lastname":"Connor"}

await client.remove.people[123](); // DELETE /people/123

const result = await client.invoke.admin/doStuff({ param1: 'Hello', param2: 2.21 });  // POST /admin/doStuff {"param1":"Hello","param2":"2.21"}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published