evertonstrack / http-service

Simple http service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Simple http service

License:MIT License


Languages

Language:JavaScript 100.0%