Skip to content

evertonstrack/http-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

http-service

Simple http service

Usage

GET:

const http = new HttpService();

// without params
http.get('/api/users')
	.then(res => console.log(res))
	.catch(err => console.log(err));
  
// with params
let params = {
  id  = 1
};

http.get('/api/users', params)
	.then(res => console.log(res))
	.catch(err => console.log(err));
	
// with response text/html
http.get('/api/users', params, 'text')
	.then(res => console.log(res))
	.catch(err => console.log(err));  
 

POST:

const http = new HttpService();


let params = {
  id: 1
};

http.post('/api/users', params)
	.then(res => console.log(res))
	.catch(err => console.log(err));

// with response text/html
http.post('/api/users', params, 'text')
	.then(res => console.log(res))
	.catch(err => console.log(err));

under construction

Releases

No releases published

Packages

No packages published