Jonjie
1 month ago
251
3
Laravel

API vs Web Route when creating SPA Application

Posted 1 month ago by Jonjie

I'm just wondering what is the best route to use when we use SPA approach with Laravel.

  1. Should I use web routes or api routes?
  2. Considering that it will also have a mobile app, so automatically I also have to create APIs for the mobile, so obviously I should use the api route it?
  3. Will it not look messy if I combine the APIs for my SPA, and the APIs for mobile app?
  4. Regarding authentication, it is automatically a stateless app so I have to also generate a token. Where should I save it, database or localStorage?

P.S. I've already read this blog https://laravel-news.com/using-vue-router-laravel

Please sign in or create an account to participate in this conversation.