New World Frontend Order - how Codeigniter fit in a javascript frontend world? |
(04-13-2020, 10:55 AM)shinseiten Wrote: Don't worry, I'll find a way and this are all very valuables information. I'm not sure what you mean by "create routes by returning an axios call that points to a server api". Are you trying to manage your nuxt/front end routes via php in the backend?
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
(04-13-2020, 02:11 PM)albertleao Wrote: I'm not sure what you mean by "create routes by returning an axios call that points to a server api". No sorry, I explained it bad. I was trying load data and generate static html by using directly an api call with axios instead of populating a json and requiring it. The only example that I found of this kind of operation was in the route generation code. Anyway, I did it. I thought nuxtServerInit would work like asyncData (and make a request everytime you enter the page), instead with "nuxt generate" it required the data and etched it in my store and then in my static pages. Now I just need to understand how to take full control of the directories where put the generated files. Put the index.html in the app/View folder and the various assets in the /public folder. If I understood correctly your insights.
You got it! asyncData is the way to go
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Hello, another question, I couldn't split the nuxts files in any way (I wanted to put assets in public/ and index.html in app/Views/), so I resorted to put everything in public and then, instead of loading the view, I did "include_once FCPATH.'nuxt-static/route/index.html'" which is ugly. is this the only way or I'm missing something?
Bonus question: it is just me or nuxt.config.js has even problems with modes? I had to do this ugly thing otherwise I wouldn't be able to "npm run dev" (many 404 errors) Code: publicPath: process.env.NODE_ENV === 'production' ? '/assets/' : '/_nuxt/', I'm feeling dumb, why everything is so difficult, so cluncky and without a proper documentation? |
Welcome Guest, Not a member yet? Register Sign In |