After the front and rear ends are separated, how to deploy the front-end code?

I develop with vue, and then npm run build generates front-end pages.
now copies the generated pages to the back-end project, which feels very inefficient.
is there a better way to deploy it after it is generated at once?
Thank you!

Mar.09,2021

have you ever heard of remote deployment?!
the front end executes the npm command directly to deploy to the server, or write a shell script. As a developer, don't just look at the front-end technology.


is the back-end engineer based on spring? I usually deploy it with the backend project, specify the static resource path of spring, and then configure nginx.


This depends on the actual situation of your project. There are two things I know:

    The
  1. project is deployed on a CVM: the front and rear ends can be deployed separately, and their respective publishing processes do not affect each other. Automatic deployment can be achieved through some means (such as git's CI). However, the front and rear ends may not be in the same domain, so cross-domain processing should be done.
  2. the project needs to be packed into an installation package and deployed on the specified machine (usually a private network server): the front and back end code will eventually be typed under an installation package, so the mainstream approach is to put the static resource package generated at the front end to the static resource directory specified by the backend. This process may be your current scenario. Whether this process can be automated or not depends on yourself, and so far we have not seen a similar solution. One advantage of this approach is that the front and rear ends are in the same domain and there is no cross-domain problem.

after the front and rear ends are separated, if it is maintained by different teams, you can consider deploying the front-end pages on separate servers. Of course, you need to solve the problem of cross-domain access first.


my current project is to build jenkins and svn, on the server and compile it on the management side every time the code is written and submitted. Jenkins can also configure to detect code updates and compile automatically, which is very convenient

.
  • Vue rendering to php template problem

    vue promotional page pre-rendered as PHP template problem for the promotional page made with vue, the page after build has only one div tag, and the contents are all used in js files. The most important thing is that some pages need php variables to o...

Menu