I have found many articles about headless wordpress and vue.js using data via WP REST API. In these articles they deploy the app on separate servers. Backend is on different server than frontend. I'm trying to find out how to deploy the app on one server.
Until now I come up with one solution: On the server create subfolder ( subdomain ) for CMS and on public upload the Vue frontend and pull the data from subdomain via WP REST API endpoint.
Is it possible to connect Wordpress and Vue without creating subdomain? I would like to upload the vue app right in the folder where is Wordpress. I think I can't put it in the theme folder of the wordpress and keep it separate at the same time. Any solutions?
I have found many articles about headless wordpress and vue.js using data via WP REST API. In these articles they deploy the app on separate servers. Backend is on different server than frontend. I'm trying to find out how to deploy the app on one server.
Until now I come up with one solution: On the server create subfolder ( subdomain ) for CMS and on public upload the Vue frontend and pull the data from subdomain via WP REST API endpoint.
Is it possible to connect Wordpress and Vue without creating subdomain? I would like to upload the vue app right in the folder where is Wordpress. I think I can't put it in the theme folder of the wordpress and keep it separate at the same time. Any solutions?
Share Improve this question asked Sep 13, 2019 at 6:41 trenccantrenccan 1484 bronze badges1 Answer
Reset to default 1Yes, it is possible to connect WordPress and Vue without a subdomain. As you're pulling data via the WP REST API it doesn't matter where WP is - same or different server, subdomain or subfolder - as long as you know its url.
You could have your Vue related files (e.g. index.html, app.css, and app.js) for example in /public_html and WP installed in /public_html/wp folder. You could then access WP from youdomain/wp and your app would be in yourdomain.
Mixing WP files and your Vue app files probably isn't a good idea as WP needs its index.php to function properly. But you could create a theme with just a index.php file in it, which would load your app scripts and the app root (i.e. <div id="app"></div>
) element.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745156810a4614172.html
评论列表(0条)