cfetcher

1.0.2 • Public • Published

A Simple fetcher wrapper javascript

wraps fetch with class, all you need is provide routes, data, and callbacks

INSTALLATION

npm -i cfetcher

after that in your js file

	//imports an object
	import cfetcher from 'cfetcher';

	//adds api behavior
	const jsoner = new cfetcher({
		"login2":{
			route:"https://jsonplaceholder.typicode.com/posts",
			method:"get",
	   },
	});	

	//after simply call 
		
		
	jsoner.execute("login2", 
		{//provide data for api query
		title: 'foo',
		body: 'bar',
		userId: 1
	} , //provide callback for success
		(ok)=>{console.log(ok)},
		//provide callback for error
		(err)=>{console.log(err)});
	
	

Readme

Keywords

Package Sidebar

Install

npm i cfetcher

Weekly Downloads

4

Version

1.0.2

License

MIT

Unpacked Size

3.31 kB

Total Files

3

Last publish

Collaborators

  • klimworkss