mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 11:33:25 +00:00
Merge branch 'docs' of https://github.com/movie-web/providers into docs
This commit is contained in:
@@ -4,13 +4,13 @@ When making an instance of the library using `makeProviders()`. It will immediat
|
||||
This comes with some considerations depending on the environment youre running.
|
||||
|
||||
## Using `fetch()`
|
||||
In most cases, you can use the `fetch()` API. This will work in newer versions of node (18 and above) and on the browser.
|
||||
In most cases, you can use the `fetch()` API. This will work in newer versions of Node.js (18 and above) and on the browser.
|
||||
|
||||
```ts
|
||||
const fetcher = makeDefaultFetcher(fetch);
|
||||
```
|
||||
|
||||
If you using older version of nodejs. You can use the npm package `node-fetch` to polyfill fetch:
|
||||
If you using older version of Node.js. You can use the npm package `node-fetch` to polyfill fetch:
|
||||
|
||||
```ts
|
||||
import fetch from "node-fetch";
|
||||
@@ -19,9 +19,9 @@ const fetcher = makeDefaultFetcher(fetch);
|
||||
```
|
||||
|
||||
## Using fetchers on the browser
|
||||
when using this library on a browser, you will need a proxy. Browser come with a ton of restrictions on when a webrequest can be made, and to bypass those restrictions you will need a cors proxy.
|
||||
When using this library on a browser, you will need a proxy. Browsers come with many restrictions on when a web request can be made, and to bypass those restrictions, you will need a cors proxy.
|
||||
|
||||
The movie-web team has a proxy pre-made and pre-configured for you to use. for more information you can check out [movie-web/simple-proxy](https://github.com/movie-web/simple-proxy). After installing you can use this proxy like so:
|
||||
The movie-web team has a proxy pre-made and pre-configured for you to use. For more information, check out [movie-web/simple-proxy](https://github.com/movie-web/simple-proxy). After installing, you can use this proxy like so:
|
||||
|
||||
```ts
|
||||
const fetcher = makeSimpleProxyFetcher("https://your.proxy.workers.dev/", fetch);
|
||||
|
Reference in New Issue
Block a user