All Projects → RickWong → Fetch Plus

RickWong / Fetch Plus

Licence: other
🐕 Fetch+ is a convenient Fetch API replacement with first-class middleware support.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Fetch Plus

Restclient
🦄 Simple HTTP and REST client for Unity based on Promises, also supports Callbacks! 🎮
Stars: ✭ 675 (+481.9%)
Mutual labels:  rest, promises, json, ajax
Restclient.net
.NET REST Client Framework for all platforms
Stars: ✭ 143 (+23.28%)
Mutual labels:  rest, json, xml
Horaires Ratp Api
Webservice pour les horaires et trafic RATP en temps réel
Stars: ✭ 232 (+100%)
Mutual labels:  rest, json, xml
Xidel
Command line tool to download and extract data from HTML/XML pages or JSON-APIs, using CSS, XPath 3.0, XQuery 3.0, JSONiq or pattern matching. It can also create new or transformed XML/HTML/JSON documents.
Stars: ✭ 335 (+188.79%)
Mutual labels:  rest, json, xml
Wretch
A tiny wrapper built around fetch with an intuitive syntax. 🍬
Stars: ✭ 2,285 (+1869.83%)
Mutual labels:  json, ajax, fetch
Rest Assured
Java DSL for easy testing of REST services
Stars: ✭ 5,646 (+4767.24%)
Mutual labels:  rest, json, xml
Http Rpc
Lightweight REST for Java
Stars: ✭ 298 (+156.9%)
Mutual labels:  rest, json, xml
Cppwebframework
​The C++ Web Framework (CWF) is a MVC web framework, Open Source, under MIT License, using C++ with Qt to be used in the development of web applications.
Stars: ✭ 348 (+200%)
Mutual labels:  rest, json, xml
Wiremock
A tool for mocking HTTP services
Stars: ✭ 4,790 (+4029.31%)
Mutual labels:  rest, json, xml
Node Rest Client
REST API client from node.js
Stars: ✭ 365 (+214.66%)
Mutual labels:  rest, json, xml
Ky
🌳 Tiny & elegant JavaScript HTTP client based on the browser Fetch API
Stars: ✭ 7,047 (+5975%)
Mutual labels:  rest, json, fetch
Ps Webapi
(Migrated from CodePlex) Let PowerShell Script serve or command-line process as WebAPI. PSWebApi is a simple library for building ASP.NET Web APIs (RESTful Services) by PowerShell Scripts or batch/executable files out of the box.
Stars: ✭ 24 (-79.31%)
Mutual labels:  rest, json, xml
Kaizen Openapi Editor
Eclipse Editor for the Swagger-OpenAPI Description Language
Stars: ✭ 97 (-16.38%)
Mutual labels:  rest, json
Restson Rust
Easy-to-use REST client for Rust programming language
Stars: ✭ 93 (-19.83%)
Mutual labels:  rest, json
Oh My Fullstack
🚀 Full stack web application skeleton (Next.js, Redux, RxJS, Immutable, Express)
Stars: ✭ 99 (-14.66%)
Mutual labels:  immutablejs, isomorphic
Iso 3166 Countries With Regional Codes
ISO 3166-1 country lists merged with their UN Geoscheme regional codes in ready-to-use JSON, XML, CSV data sets
Stars: ✭ 1,372 (+1082.76%)
Mutual labels:  json, xml
Metayaml
A powerful schema validator!
Stars: ✭ 92 (-20.69%)
Mutual labels:  json, xml
Crawlerpack
Java 網路資料爬蟲包
Stars: ✭ 99 (-14.66%)
Mutual labels:  json, xml
Marklogic Data Hub
The MarkLogic Data Hub: documentation ==>
Stars: ✭ 113 (-2.59%)
Mutual labels:  json, xml
Flickr Sdk
Almost certainly the best Flickr API client in the world for node and the browser
Stars: ✭ 104 (-10.34%)
Mutual labels:  rest, json

Fetch+

A convenient Fetch API library with first-class middleware support.

version license Package Quality installs

Features

  • Drop-in replacement for fetch().
  • Simple BREAD methods for consuming REST APIs.
  • A "queries" object option for building safe query strings more easily.
  • All options can be computed values: myHeaders: () => values
  • Custom middlewares to manipute requests, responses, and caught errors.
  • Useful middlewares and handlers (JSON/Auth/CSRF/Immutable etc) available as separate npm packages.
  • Fetch API Streams draft handler with an Observable interface.
  • Runs in Node and all browsers.

Installation

npm install --save fetch-plus  isomorphic-fetch

Additional middlewares

npm install --save fetch-plus-basicauth
npm install --save fetch-plus-bearerauth
npm install --save fetch-plus-csrf
npm install --save fetch-plus-immutable
npm install --save fetch-plus-json
npm install --save fetch-plus-oauth
npm install --save fetch-plus-stream
npm install --save fetch-plus-useragent
npm install --save fetch-plus-xml

Usage

import/require

import {fetch, createClient} from "fetch-plus";

fetch

fetch("http://some.api.example/v1", {
	query: {foo: "bar"},                // Query string object. So convenient.
	body: () => "R2-D2"                 // Computed values are computed.
});

createClient

Creates a RESTful client so middlewares can be added to it.

const client = createClient("http://some.api.example/v1");

client.addMiddleware

Create middlewares like: (request) => (response) => response

client.addMiddleware(
	(request) => {
		request.path += ".json";
		request.options.headers["Content-Type"] = "application/json; charset=utf-8";

		return (response) => response.json();
	}
);

client.request

request performs generic requests to the configured endpoint.

client.request("posts/25/comments", {
	method: "POST",
	body: {comment: "C-3PO"}
});

client.browse|read|edit|add|destroy|replace

BREAD helpers that perform requests to the configured endpoint.

client.browse(            
	"posts"                    // A string...
);

client.add(
	["posts", 1, "comments"],  // ...or an array like ["posts", id, "comments"]
	{body: "C-3PO"}            // Regular Fetch API body option.
);

client.list|create|read|update|destroy

CRUD aliases that perform requests to the configured endpoint.

client.list(            
	"posts"                    // A string...
);

client.create(
	["posts", 1, "comments"],  // ...or an array like ["posts", id, "comments"]
	{body: "C-3PO"}            // Regular Fetch API body option.
);

handlers

Handlers take configuration and return functions to pass to .then().

// Transform JSON with fetch-plus-json.
import plusJson from "fetch-plus-json";

fetch("http://some.api.example/v1/posts").then(plusJson.handler({some:"config"}));

See example for more.

Community

Let's start one together! After you ★Star this project, follow me @Rygu on Twitter.

License

BSD 3-Clause license. Copyright © 2015, Rick Wong. All rights reserved.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].