Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

178
Visualizações
How to use google calendar api for JavaScript with npm install?? Or is it possible to use google calendar api for nodejs in browser in Nextjs?

I want to use google calendar api as library in Next.js without using _document.tsx. In that case, I have come up with 2 ways which might be possible as below;

  1. Use google calendar api for JavaScript with npm install
  2. Use google calendar api for node.js in browser in Next.js

Regarding 1, there is seemingly no ways to npm install xxx in the official site here, but <script src="https://apis.google.com/js/api.js"></script> is said to use. This is not what I wanted because I use Next.js so I wanna use this library using npm install.

As for method 2, npm install googleapi is introduced on the official site here, but I'm still concerned that it may only work on the server side. Since I am creating a dashboard-like site, I want to call the API from the client side (browser) when users request their dashboard, so if I can only run it on the server side, it will be a problem for me!

Anyone can answer that??

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Method 1

This approach is viable. You mentioned not wanting to use _document.tsx which makes me think you're not sure where to place the <script> tag that imports 3rd-party JS or if that's even allowed in Next.js. It is — you would use Next.js' custom <Script> component instead which can be used in other pages and components. You'd just have to port this example over to Next.js/React.

Method 2

The googleapis (or @googleapis/calendar) package will only work on the server side, but you can still call/access them from the client side (browser) if you import them into API pages. For example, pages/api/gcal.ts would import @googleapis/calendar then pages/index.tsx would make a client-side data request to http://localhost:3000/api/gcal.

So for your case, I think method 2 is what you'd want.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda