[英]Better way to create a web application with Java and Vue
I'm starting to get into web development a little more. 我开始进入Web开发了一点点。 Currently I use the Spark Framework along with Vue for the few apps I've made. 目前,我将Spark框架与Vue一起用于我制作的少数应用程序。 While this certainly works it's not ideal. 虽然这肯定有效,但并不理想。
The project is built with Maven (and NPM for Vue) and the build process looks something like this. 该项目是使用Maven(和NPM for Vue)构建的,构建过程看起来像这样。
So the filesystem looks something like this 所以文件系统看起来像这样
/src/main/java (Spark Framework) / src / main / java(Spark框架)
/src/main/resources (Vue) / src / main / resources(Vue)
This leads to a couple of annoyances. 这会导致一些烦恼。
Here's one of my projects that uses this model 这是我使用此模型的一个项目
So my question is: What's a better way to structure my application? 所以我的问题是: 构建我的应用程序的更好方法是什么?
I've had a few months to think and in that time I've created a few more applications with Vue, here's the workflow I've started to take. 我有几个月的时间来思考,在那段时间我用Vue创建了一些应用程序,这是我开始采用的工作流程。
I create a GitHub organization for any project that has more than one layer. 我为任何具有多个图层的项目创建了一个GitHub组织。 For example, many of my projects have a REST API written in Java or JavaScript, and a web interface with Vue. 例如,我的许多项目都有一个用Java或JavaScript编写的REST API,以及一个带Vue的Web界面。 This organization will contain a repository for each layer. 该组织将包含每个层的存储库。 Here's a link to an organization that follows this idea. 这是一个遵循这个想法的组织的链接 。
This allows me to separate my backend and frontend, but it complicated deployment. 这允许我分离我的后端和前端,但它复杂的部署。 I can no longer serve my Vue files with the same web server as the API, but upon further thought that's probably a good thing. 我不能再使用与API相同的Web服务器来提供我的Vue文件,但进一步认为这可能是一件好事。
With this pattern I can host my static Vue site on Amazon S3 which is extremely cheap, and use free dynos with Heroku to host my API. 使用这种模式,我可以在Amazon S3上托管我的静态Vue站点,这非常便宜,并使用Heroku的免费dynos来托管我的API。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.