#Correct HTTP response codes for SPA routes

17 messages · Page 1 of 1 (latest)

radiant sky
#

Not sure what you mean here, you have a route that catches all paths, so any path that ends up in that controller would return whatever that controller returns. So yeah, it's up to you what you return there, if you always return a 200, then you're always going to see a 200 response

#

Also, that string syntax for the route action has not been used in the docs for quite some time, I would advice not to use it

#

I have no clue what you're saying really.. You have one single route that does litterally everything in your app? From returning posts, to returning comments to whatever..?

worldly ferry
#

have you considered inertia? if duplicating routes is your issue & your just using Vue & not Nuxt.

#

ALso im not really sure what your saying with this catch all controller thing either 🤷‍♂️

radiant sky
#

Yeah, still no clue what you're actually asking here.

opal marlin
#

sound like a Route::fallback?

worldly ferry
#

But what do you mean rewriting if you don't have a backend, with pages of routes & many controllers?

#

Confused...

radiant sky
#

Okay so now it makes a bit more sense. Then no, your routes are probably defined with the Vue-Router, so that's client-side. Then there's no way to know server-side if that route exists client-side

worldly ferry
radiant sky
worldly ferry
#

true...

radiant sky
#

Guess you could take that approach, define your routes server-side, then pass them to your JS app and initialize the router with those routes. Then in your controller you can check if the routes exist

#

But in all honesty, this sounds like a whacky solution and you might be better off taking the Breeze Nuxt + API approach

#

But I suggested a solution shrug And the way Breeze does it as an alternative, that wouldn't be an enormous undertaking either I guess (at least way less than Inertia), it would mean to stip out your Vue app and make it a separate repo, serve the Vue app and just use your Laravel app as API, the same way the Breeze/Nuxt combo does it