Some checks failed
Monorepo Pipeline / ⚡ Prioritize Release (push) Successful in 2s
Monorepo Pipeline / 🧪 Test (push) Failing after 51s
Monorepo Pipeline / 🧹 Lint (push) Failing after 2m25s
Monorepo Pipeline / 🏗️ Build (push) Successful in 2m28s
Monorepo Pipeline / 🚀 Release (push) Has been skipped
Monorepo Pipeline / 🐳 Build Gatekeeper (Product) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Build-Base (push) Has been skipped
Monorepo Pipeline / 🐳 Build Production Runtime (push) Has been skipped
39 lines
777 B
TypeScript
39 lines
777 B
TypeScript
import * as dotenv from "dotenv";
|
|
import axios from "axios";
|
|
|
|
dotenv.config({ path: "../../.env" });
|
|
dotenv.config({ path: "../../apps/web/.env" });
|
|
|
|
async function testSerper() {
|
|
const query = "Mittelspannungskabel";
|
|
const apiKey = process.env.SERPER_API_KEY || "";
|
|
|
|
if (!apiKey) {
|
|
console.error("Missing SERPER_API_KEY");
|
|
return;
|
|
}
|
|
|
|
try {
|
|
const response = await axios.post(
|
|
"https://google.serper.dev/search",
|
|
{
|
|
q: query,
|
|
gl: "de",
|
|
hl: "de",
|
|
},
|
|
{
|
|
headers: {
|
|
"X-API-KEY": apiKey,
|
|
"Content-Type": "application/json",
|
|
},
|
|
},
|
|
);
|
|
|
|
console.log(JSON.stringify(response.data, null, 2));
|
|
} catch (error) {
|
|
console.error("Error:", error);
|
|
}
|
|
}
|
|
|
|
testSerper();
|