java - 如何使用 Nginx 和 dropwizard 部署 angularjs 应用程序前端

标签 java angularjs nginx web-deployment dropwizard

我正在使用具有后端 dropwizard 的 angularjs 应用程序前端开发一个应用程序。我计划使用 Nginx 作为后端 dropwizard 服务器的网关和 Assets 服务器(图像,也许还有 angularjs 应用程序)。

我的问题是最好的部署策略是什么:

  1. 将 angularjs 与 dropwizard 后端捆绑在一起并使用 nginx 作为前端?
  2. 在 nginx 服务器上部署 angularjs 应用程序?

提前致谢

最佳答案

我会将 nginx 用作 API Gateway将您的请求路由到您的后端。

Implement an API gateway that is the single entry point for all clients. The API gateway handles requests in one of two ways. Some requests are simply proxied/routed to the appropriate service. It handles other requests by fanning out to multiple services.

使用网关,您可以根据需要灵活地更改后端。因为 nginx 仅作为网关工作,他还可以为您的静态文件 (angularjs) 提供服务。网关具有更多优势,例如日志记录、身份验证等。

关于java - 如何使用 Nginx 和 dropwizard 部署 angularjs 应用程序前端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30307216/

相关文章:

javascript - 从带有参数的 Angular Controller 启动函数

ruby - 修复 OS X 上 Phusion Passenger + Sinatra +Nginx 的权限错误

nginx - 尝试使用 luajit 支持构建 nginx 但 libluajit-5.1.so.2 : cannot open shared object file

java - 在两个 Activity 之间旋转设备时出现 configChanges 问题 [+VIDEO]

javascript - 尝试在 https ://api. thetvdb.com/向 TVDB REST API 发出 JSON POST 请求,但收到 CORS 错误

java - UPI交易ID是如何生成的

angularjs - 检测是否通过 SSL 访问应用程序?

java - 响应式 Java Webflux 请求在 60 秒后终止

java - 为什么我的合并列表算法不起作用

java - HashSet什么时候调用equal方法?