Skip to content

Commit 5d1a4f9

Browse files
committed
Update examples
1 parent 2ca76af commit 5d1a4f9

File tree

26 files changed

+56
-12
lines changed

26 files changed

+56
-12
lines changed
File renamed without changes.

examples/node/basic_js_esm/README.md renamed to examples/node/basic_js_node_14_up/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Node.js basic JavaScript (ESM) example
1+
# Basic JavaScript example for Node.js 14 and newer
22

33
## Usage
44

@@ -17,7 +17,7 @@ deno task npm
1717
3. Install dependencies and run example
1818

1919
```bash
20-
cd examples/node/basic_js_esm
20+
cd examples/node/basic_js_node_14_up
2121
npm i
2222
npm start
2323
```

examples/node/basic_js_esm/example.js renamed to examples/node/basic_js_node_14_up/example.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* Example works for Node.js 14 and newer.
3+
* - Uses ESM imports which is supported from Node.js 13.2.0.
4+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#browser_compatibility
5+
* - Uses top-level await which is supported from Node.js 14.8.0.
6+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#browser_compatibility
7+
*/
8+
19
import * as Dotenv from "dotenv";
210
import { config, getJson } from "serpapi";
311

File renamed without changes.
File renamed without changes.

examples/node/basic_js_commonjs/README.md renamed to examples/node/basic_js_node_7_up/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Node.js basic JavaScript (CommonJS) example
1+
# Basic JavaScript example for Node.js 7 and newer
22

33
## Usage
44

@@ -17,7 +17,7 @@ deno task npm
1717
3. Install dependencies and run example
1818

1919
```bash
20-
cd examples/node/basic_js_commonjs
20+
cd examples/node/basic_js_node_7_up
2121
npm i
2222
npm start
2323
```

examples/node/basic_js_commonjs/example.js renamed to examples/node/basic_js_node_7_up/example.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Example works for Node.js 7 and newer.
3+
*/
4+
15
const Dotenv = require("dotenv");
26
const { config, getJson } = require("serpapi");
37

File renamed without changes.
File renamed without changes.

examples/node/pagination_ts_esm/README.md renamed to examples/node/basic_ts_node_14_up/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Node.js pagination TypeScript (ESM) example
1+
# Basic TypeScript example for Node.js 14 and newer
22

33
## Usage
44

@@ -17,7 +17,7 @@ deno task npm
1717
3. Install dependencies and run example
1818

1919
```bash
20-
cd examples/node/pagination_ts_esm
20+
cd examples/node/basic_ts_node_14_up
2121
npm i
2222
npm start
2323
```

0 commit comments

Comments
 (0)