Welcome Guest, Not a member yet? Register   Sign In
New World Frontend Order - how Codeigniter fit in a javascript frontend world?
#21

(04-13-2020, 10:55 AM)shinseiten Wrote: Don't worry, I'll find a way and this are all very valuables information.

Another problem. I thought to have solved it but I can't find a proper way... I can create routes by returning an axios call that points to a server api. Can I do the same thing, but with data to insert into the store?
So I can cronjob only che "nuxt generate" and I don't have to create a JSON file to import.

Sorry if I'm bombarding you with questions, but I'm exploring and I can't find many answers online (I often do a lot of research and test)


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!
Reply
#22

(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".

Are you trying to manage your nuxt/front end routes via php in the backend?

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.
Reply
#23

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!
Reply
#24

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/',
base: process.env.NODE_ENV === 'production' ? '/nuxt-path/' : '/'

I'm feeling dumb, why everything is so difficult, so cluncky and without a proper documentation?  Cry
Reply




Theme © iAndrew 2016 - Forum software by © MyBB