The front-end team and the back-end team are working together to develop a project. The front-end uses Vue, and all data is an asynchronous request interface; the back-end uses Laravel to only provide the API interface. The company requires that the request address of the front-end page and the request address of the back-end API must be under the same domain, and the front-end and back-end must be separated to the greatest extent possible.
What I think is that the laravel framework is responsible for the routing of the api interface, and the routing of the front-end pages is allocated by the front-end staff through vue-router. The front-end only needs to put the written html, js, css/less/sass, .vue, etc. The files are given to the backend, and the backend puts the front-end files into the laravel framework, and then performs the compilation through the compilation method provided by laravel, and then the corresponding page can be accessed according to the route set by the front-end. Can such an idea be realized? Where should the front-end code be placed?
黄舟2017-05-16 16:48:33
What I am working on is a laravel+vue single-page application project. Laravel does the API, and Vue does the page display. Because it is my own practice project, I use the hash mode of vue-router. The front-end code is placed in the resource directory according to Laravel's specifications.