@@ -197,125 +197,86 @@ TODO
197
197
198
198
# # JavaScript (axios)
199
199
200
- ` Axios` is a promise-based HTTP client for the browser and Node.js.
201
- # ## 1. Installation:
202
- -Ensure Node.js and npm are installed. Verify by running:
200
+ TODO
201
+
202
+ # # JavaScript (fetch)
203
+
204
+ TODO
205
+
206
+ # # node.js (JavaScript, axios)
207
+
208
+ # ## 1.Install Node.js:
209
+ Ensure Node.js and npm are installed. Verify by running:
203
210
204
211
` ` ` bash
205
212
node --version
206
213
npm --version
207
214
` ` `
208
- -If not, download from Node.js ** [Official Website](( https:// nodejs.org/ en)) ** .
209
215
210
- -Initialize a new Node.js project:
216
+ If not, download from Node.js ** [Official Website](( https:// nodejs.org/ en)) ** .
217
+
218
+ Initialize a new Node.js project:
211
219
212
220
` ` ` bash
213
221
npm init -y
214
222
` ` `
215
223
216
- - Install Axios:
224
+ Install Axios:
217
225
218
226
` ` ` bash
219
227
npm install axios
220
228
` ` `
221
229
222
- # ## 2. Running the Generated Code::
223
- -Create a new JavaScript file (` e.g., app.js` ).
224
- -Copy and paste the generated code into this file.
225
- -Open a terminal and navigate to the project directory.
226
- -Run the script:
230
+ # ## 2.Set Up a New Project:
231
+ Create a new project directory:
227
232
228
233
` ` ` bash
229
- node app.js
234
+ mkdir node-axios-example
235
+ cd node-axios-example
230
236
` ` `
231
237
232
- # # JavaScript (fetch)
233
-
234
- macOS, Linux, and Windows:
235
- # ## 1. Node.js:
236
- -Follow the same steps as above to install Node.js.
238
+ Initialize the project:
237
239
238
- # ## 2. Set Up a New Project:
239
- -Create a new project folder and navigate into it
240
- ` ` ` bash
241
- mkdir fetch-example
242
- cd fetch-example
243
- ` ` `
244
- -Initialize the project:
245
240
` ` ` bash
246
241
npm init -y
247
242
` ` `
248
243
249
- # ## 3. Ensure Fetch API Support:
250
- -Starting with Node.js 18, the Fetch API is built-in. Verify the version:
244
+ # ## 3.Create and Run the Code:
251
245
252
- ` ` ` bash
253
- node --version
254
- ` ` `
246
+ Save the generated code in a file(e.g., ` app.js` ).
255
247
256
- -If you’re using an earlier version, install a Fetch polyfill :
248
+ Run the code :
257
249
258
250
` ` ` bash
259
- npm install node-fetch
251
+ node app.js
260
252
` ` `
261
253
262
- # ## 4. Create and Run the Code:
263
- -Save the generated code in a file, e.g., fetch_example.js.
264
- -If using node-fetch, add this line at the top of your file:
265
-
266
- ` ` ` bash
267
- const fetch = require(' node-fetch' );
268
- ` ` `
254
+ # # node.js (JavaScript, fetch)
269
255
270
- -Run the code:
256
+ # ## 1. Install Node.js:
257
+ Ensure Node.js and npm are installed. Verify by running:
271
258
272
259
` ` ` bash
273
- node fetch_example.js
260
+ node --version
261
+ npm --version
274
262
` ` `
275
263
276
- # # node.js (JavaScript, axios)
277
-
278
- macOS, Linux, and Windows:
279
- # ## 1.Install Node.js:
280
- -Follow the installation steps above.
264
+ If not, download from Node.js ** [Official Website](( https:// nodejs.org/ en)) ** .
281
265
282
- # ## 2.Set Up a New Project:
283
- -Create a new project directory:
284
-
285
- ` ` ` bash
286
- mkdir node-axios-example
287
- cd node-axios-example
288
- ` ` `
289
-
290
- -Initialize the project:
266
+ Initialize a new Node.js project:
291
267
292
268
` ` ` bash
293
269
npm init -y
294
270
` ` `
295
271
296
- # ## 3.Install Axios:
272
+ If using Node.js 18 or newer, the Fetch API is already built-in.
297
273
298
- -Install the Axios library :
274
+ For older versions, install the ` node-fetch ` package :
299
275
300
276
` ` ` bash
301
- npm install axios
302
- ` ` `
303
-
304
- # ## 4.Create and Run the Code:
305
-
306
- -Save the generated code in a file(` e.g., app.js` ).
307
- -Run the code:
308
-
309
- ` ` ` bash
310
- node app.js
277
+ npm install node-fetch
311
278
` ` `
312
279
313
- # # node.js (JavaScript, fetch)
314
-
315
- macOS, Linux, and Windows:
316
- # ## 1. Install Node.js:
317
- -Follow the installation steps above.
318
-
319
280
# ## 2. Set Up a New Project:
320
281
Create a project directory:
321
282
@@ -324,29 +285,21 @@ mkdir node-fetch-example
324
285
cd node-fetch-example
325
286
` ` `
326
287
327
- # ## 3. Initialize the project:
288
+ Initialize the project:
328
289
329
290
` ` ` bash
330
291
npm init -y
331
292
` ` `
332
293
333
- # ## 4.Ensure Fetch API Support:
334
- -If using Node.js 18 or newer, the Fetch API is already built-in.
335
- -For older versions, install the ` node-fetch` package:
336
-
337
- ` ` ` bash
338
- npm install node-fetch
339
- ` ` `
340
-
341
- # ## 5.Create and Run the Code:
342
- -Save the generated code in a file( ` e.g., app.js` ).
343
- -If using ` node-fetch` , add the following line to the top of the file:
294
+ # ## 3.Create and Run the Code:
295
+ Save the generated code in a file( e.g., ` app.js` ).
296
+ If using ` node-fetch` , add the following line to the top of the file:
344
297
345
298
` ` ` javascript
346
299
const fetch = require(' node-fetch' );
347
300
` ` `
348
301
349
- - Run the file:
302
+ Run the file:
350
303
351
304
` ` ` bash
352
305
node app.js
0 commit comments