I'm new to nuxt js just learning now but when adding a rest api it's showing me an CORS error through api , I try many different solution but i don't know how solve this. can you please explain me how to add restapi with credential required and get data in server side not client side . because when using node js it's fine API showing fetch data correctly in terminal
Can I direct you to the Nuxt discord community (discord.com/invite/ps2h6QT) where you can have a better dialogue about this with the Nuxt community - myself included.
Thanks for watching - client side you can get the Nuxt context from the 'window' object e.g. window.$nuxt.$config.apiKey. You might be able to use events server side e.g. OnMounted nuxtjs.org/docs/concepts/server-side-rendering/#server-vs-browser-environments
@@thepragmaticprogrammer thank you, that's very useful info! Actually, according to example you provided in the beginning of video with different API keys - the point is to hide that API from potential malefactors. But then you show how to display some telephone on frontend. I would not to recommend that for dev API keys. For that purpose I used .env file with .gitignore, imo this solution suits better described case.