Skip to content

Latest commit

 

History

History
54 lines (37 loc) · 839 Bytes

README.md

File metadata and controls

54 lines (37 loc) · 839 Bytes

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