Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
NEXTJS API de tendencias de Google

Tiene problemas para usar la API de Google Trends de npm en NEXTJS

No estoy seguro si esta es la manera correcta de hacerlo.

Hice una nueva ruta API.

 http://localhost:3000/api/trends

http://localhost:3000/api/tendencias

 import googleTrendsApi from "google-trends-api"; const handler = async (res, req) => { const data = await googleTrendsApi .interestOverTime({ keyword: ["Women's march", "Trump Inauguration"] }) .then(function (results) { console.log("These results are awesome", results); }); res.status(200).json({ data: data }); };

me sale un error diciendo

 TypeError: res.status is not a function
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Prueba esto. Aquí estoy usando TypeScript, si está usando Javascript, edite el código según sea necesario.

 import type { NextApiRequest, NextApiResponse } from 'next' import googleTrendsApi from "google-trends-api"; type Data = { name: string } export default function handler( req: NextApiRequest, res: NextApiResponse<Data> ) { const data = googleTrendsApi .interestOverTime({ keyword: ["Women's march", "Trump Inauguration"] }) .then(function (results: any) { res.status(200).json(results) }); }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!