rouckay's avatar

rouckay wrote a reply+100 XP

3mos ago

I have the same issue I can't able to write the logic for my app from scratch is there any way to generate the API from existance controller?

rouckay's avatar

rouckay liked a comment+100 XP

3mos ago

I think ideally you'll want dedicated api routes that use similar functionality. What that might look like in practice would be stripping logic out of your controllers into reusable traits so that your controller methods simply call the appropriate trait method to get data, and the controller responds either with a view template for your existing routes or with json for new api routes.

As for authentication, you'll likely want to use something like JWT

rouckay's avatar

rouckay liked a comment+100 XP

5mos ago

I was able to find the command herd restart, and that ran as expected (after restarting my terminal). However, the site still didn't work. I went into Herd and made the site secure, and for some reason that made the site work. I'm guessing something was cached, but I hope this helps someone else that might be having the same issue.