serpnode-js
Version:
Serpnode.com API client for Node.js
46 lines (29 loc) • 986 B
Markdown
Minimal Node.js client for the Serpnode API. Supports authentication via `apikey` header (default) or as a query parameter, and exposes the core endpoints: `status`, `search`, `options`, and `locations`.
- Requires Node.js >= 18 (uses global `fetch`).
```bash
npm install serpnode-js
```
```js
import { SerpnodeClient } from "serpnode-js";
const client = new SerpnodeClient({
apiKey: process.env.SERPNODE_API_KEY,
// baseUrl: "https://api.serpnode.com/v1",
// authInQuery: false,
});
const status = await client.status();
console.log(status);
const search = await client.search({ q: "site:example.com" });
console.log(search);
const opts = await client.options();
console.log(opts);
const locs = await client.locations({ q: "United States" });
console.log(locs);
```
- Default: `apikey: <API_KEY>` header
- Alternative: set `authInQuery: true` to send `apikey=<API_KEY>` query parameter
MIT