isomorphic-fetch

Isomorphic WHATWG Fetch API, for Node & Browserify

  • 所有者: matthew-andrews/isomorphic-fetch
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

isomorphic-fetch Build Status

Fetch for node and Browserify. Built on top of GitHub's WHATWG Fetch polyfill.

Warnings

  • This adds fetch as a global so that its API is consistent between client and server.
  • You must bring your own ES6 Promise compatible polyfill, I suggest es6-promise.

For ease-of-maintenance and backward-compatibility reasons, this library will always be a polyfill. As a "safe" alternative, which does not modify the global, consider fetch-ponyfill.

Installation

NPM

npm install --save isomorphic-fetch es6-promise

Bower

bower install --save isomorphic-fetch es6-promise

Usage

require('es6-promise').polyfill();
require('isomorphic-fetch');

fetch('//offline-news-api.herokuapp.com/stories')
	.then(function(response) {
		if (response.status >= 400) {
			throw new Error("Bad response from server");
		}
		return response.json();
	})
	.then(function(stories) {
		console.log(stories);
	});

License

All open source code released by FT Labs is licenced under the MIT licence. Based on the fine work by jxck.

主要指标

概览
名称与所有者matthew-andrews/isomorphic-fetch
主编程语言JavaScript
编程语言JavaScript (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2014-11-07 08:46:13
推送于2024-06-27 10:34:24
最后一次提交2020-09-23 16:24:11
发布数26
最新版本名称v3.0.0 (发布于 2020-09-23 16:24:11)
第一版名称v1.0.0 (发布于 2014-11-07 21:18:06)
用户参与
星数6.9k
关注者数79
派生数286
提交数91
已启用问题?
问题数152
打开的问题数45
拉请求数19
打开的拉请求数11
关闭的拉请求数28
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?