Skip to content

Commit 1f4f4ed

Browse files
committed
Update docs
1 parent 7e88680 commit 1f4f4ed

3 files changed

Lines changed: 32 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to
1111
### Added
1212

1313
- Expose `EngineName`, `EngineParameters` and `AllowArbitraryParams` types.
14+
- Add support for Node.js 7.10.1 and newer.
1415

1516
### Changed
1617

README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,39 @@ more.
1717

1818
### Node.js
1919

20-
Ensure you're running at least Node.js v16.14.
20+
- Supports Node.js 7.10.1 and newer.
21+
- Refer to [this example](examples/node/basic_js_node_7_up) for help.
2122

2223
```bash
2324
npm install serpapi
2425
```
2526

27+
```js
28+
const { getJson } = require("serpapi");
29+
getJson("google", {
30+
api_key: API_KEY, // Get your API_KEY from https://serpapi.com/manage-api-key
31+
q: "coffee",
32+
location: "Austin, Texas",
33+
}, (json) => {
34+
console.log(json["organic_results"]);
35+
});
36+
```
37+
38+
### Node.js with ES Modules (ESM) and top-level await
39+
40+
- If you prefer using the `import` syntax and top-level `await`, you need to use
41+
at least Node.js 14.8.0.
42+
- Refer to [this example](examples/node/basic_js_node_14_up) for help.
43+
44+
You will need to add `"type": "module"` to your `package.json`:
45+
46+
```js
47+
{
48+
"type": "module",
49+
// rest of package.json
50+
}
51+
```
52+
2653
```js
2754
import { getJson } from "serpapi";
2855
const response = await getJson("google", {
@@ -35,7 +62,9 @@ console.log(response);
3562

3663
### Deno
3764

38-
Import directly from deno.land. Usage is otherwise the same as above.
65+
- Import directly from deno.land.
66+
- Usage is otherwise the same as above.
67+
- Refer to [this example](examples/deno/basic_ts) for help.
3968

4069
```ts
4170
import { getJson } from "https://deno.land/x/serpapi/mod.ts";

docs/migrating_from_google_search_results_nodejs.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ migrate over to the `serpapi` npm package.
5151
- The `buildUrl`, `execute` and `search` methods are removed. Use `getJson` and
5252
`getHtml` functions instead.
5353
- The `SerpApiSearch` class is removed as a public class.
54-
- Dropped support for Node.js 16.13 and below. This module supports Node.js
55-
16.14 and above.
5654

5755
## Fixed
5856

0 commit comments

Comments
 (0)