File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,30 @@ fetcher.configure({
125
125
fetcher .use (logger )
126
126
```
127
127
128
+ ### Server Side Usage
129
+
130
+ This library can be used server side with [ node-fetch] ( https://www.npmjs.com/package/node-fetch )
131
+
132
+ Node CommonJS setup
133
+ ``` ts
134
+ // install node-fetch v2
135
+ npm install node - fetch @2
136
+ npm install @types / node - fetch @2
137
+
138
+ // fetch-polyfill.ts
139
+ import fetch , { Headers , Request , Response } from ' node-fetch'
140
+
141
+ if (! globalThis .fetch ) {
142
+ globalThis .fetch = fetch as any
143
+ globalThis .Headers = Headers as any
144
+ globalThis .Request = Request as any
145
+ globalThis .Response = Response as any
146
+ }
147
+
148
+ // index.ts
149
+ import ' ./fetch-polyfill'
150
+ ```
151
+
128
152
### Utility Types
129
153
130
154
- ` OpArgType ` - Infer argument type of an operation
You can’t perform that action at this time.
0 commit comments