search

Home  >  Q&A  >  body text

Nuxt.js SSG (Static Site Generator) Get API Data

When building a project using a static site generator, I understand that documentation created in advance is provided to the user.

If there is logic such as using axios to obtain data and display it on the screen when entering the page, is the corresponding API cached or not called?

P粉593536104P粉593536104436 days ago905

reply all(1)I'll reply

  • P粉729436537

    P粉7294365372023-11-17 11:29:15

    You have 2 lifecycle hooks available for fetching data: fetch and asyncData, as shown below: https://nuxtjs.org/docs/features/ data-fetching

    Depending on how you organize your project and your needs, SSG will generate content ahead of time, some of which can also be run on the client, for example if you need some authenticated content.

    reply
    0
  • Cancelreply