1.1.0 • Published 5 years ago

restful-service v1.1.0

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

Restful-Service

License

Restful service is HTTP adapter for the front-end using native window fetch for making network calls

Installation

Install the dependencies and devDependencies and start the server.

$ npm install restful-service
or
$ yarn add restful-service

Usage

import { restGet, restPost } from 'restful-service';

const promise = restGet(urlString)();
promise.then(result => console.log(result));
    
const res = restPost(urlString)(payloadObject)();
res.then(r => console.log(r))

Examples

Get Request:
import { restGet, restPost } from 'restful-service';

const promise = restGet('https://jsonplaceholder.typicode.com/users')()
promise.then(result => console.log(result))
Post Request:
const promise = restPost('https://jsonplaceholder.typicode.com/posts')({
  title: 'foo',
  body: 'bar',
  userId: 1
})();
promise.then(result => console.log(result))
1.1.0

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago