Rails 5.1+ Vuejs Webpacker: Normal Rails MVC vs Rails API
For using Rails in API --api
mode there is official documentation about that to be found here:
http://guides.rubyonrails.org/api_app.html
This sets up a JSON API, so no view layers or any middleware for that.
When using the command --webpack=vue
you do get the view layers. A good example of how you could work with that can be found at GoRails:
https://gorails.com/episodes/tagged/VueJS (Using VueJS for Nested Forms)
What you'll see is that like this you could have multiple SPA's spread out over your rails views directory.
I personally will choose for a separation of the two codebases. This would mean a Rails 5 API and then figuring out how VueJS can communicate back to it so everything works properly.
Setting up a solid Rails 5 API that's well tested is described here:
http://aalvarez.me/blog/posts/testing-a-rails-api-with-rspec.html
Also excellent and to the point:
https://paweljw.github.io/2017/07/rails-5.1-api-with-vue.js-frontend-part-0-stack-choices/
Please let me know your findings.