简体   繁体   English

在本地部署 node.js 前端和 spring 启动后端作为自包含应用程序

[英]Deploying a node.js frontend and spring boot backend as a self contained app locally

I have a web app that has a separate spring boot backend and a nodejs frontend.我有一个 web 应用程序,它有一个单独的 spring 引导后端和一个 nodejs 前端。

is it possible to make them both run on the same bundle, like building a singe executable?是否有可能让它们在同一个包上运行,比如构建一个单一的可执行文件? or do i need a stand alone service for each?还是我需要为每个人提供独立服务? Both are having their own jenkins pipelines and git repositories.两者都有自己的 jenkins 管道和 git 存储库。

My backend server is just a API that provides the frontend with simple data via REST services.我的后端服务器只是一个 API,它通过 REST 服务为前端提供简单的数据。 If it is possible what would be the way to do it?如果可能的话,这样做的方法是什么?

A nodejs is a backend technology, not frontend. nodejs 是一种后端技术,而不是前端。

You can use a nodejs as an entry point to a spring boot application but it is a code running on the server side.您可以使用 nodejs 作为 spring 启动应用程序的入口点,但它是在服务器端运行的代码。 So nodejs is not just a list of static files as it happens for a real front end developed in react, angular or vue (or vanilla javascript).所以 nodejs 不仅仅是一个 static 文件的列表,因为它恰好是在 react 中开发的真正前端,angular 或 vue(或 vanilla javascript)。 It has also an engine to run the code.它还有一个运行代码的引擎。

So is not possible to run nodejs server using files that are compressed in the executable jar. Instead is possible to put a real front end application (react, angular...) adding static files in the directory /resources/static因此不可能使用在可执行文件 jar 中压缩的文件运行 nodejs 服务器。相反可以放置一个真正的前端应用程序(反应,angular ...)在目录/resources/static中添加 static 文件

It was maybe a little missleading.这可能有点误导。 My frontend is an app runing on node.js server and may backend is a java app runing on spring boot server.我的前端是一个在 node.js 服务器上运行的应用程序,后端可能是一个在 spring 启动服务器上运行的 java 应用程序。 They are communicating on localhost via Rest.他们通过 Rest 在本地主机上进行通信。

I want to create a single entry point that starts the node.js server (I call this unit frontend) and the spring boot server ("backend") at the same time.我想创建一个同时启动 node.js 服务器(我称此单元为前端)和 spring 引导服务器(“后端”)的入口点。 So it feels like a self contained system.Currently the spring boot app is delivered as windows executable.所以它感觉像是一个独立的系统。目前 spring 引导应用程序作为 windows 可执行文件交付。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM