【问题标题】:How to bring in polymer web app into google app engine java如何将聚合物网络应用程序引入谷歌应用程序引擎java
【发布时间】:2016-02-10 13:51:08
【问题描述】:
我正在尝试找出如何将聚合物集成到用 java 编写的谷歌应用引擎项目中的工作流程。
根据聚合物文档构建聚合物应用程序,您必须运行 gulp。这会构建然后生成可以在某个端口上提供的 dist 代码。我想知道,既然它生成了一个静态的 dist 文件夹,我可以在我的 WEB-INF 文件夹中配置一个 web.xml 以将 dist 文件夹作为我的前端并部署它吗?
【问题讨论】:
标签:
java
google-app-engine
google-cloud-endpoints
polymer-1.0
polymer-starter-kit
【解决方案1】:
如果只是静态文件,你甚至不需要在java中配置项目。带有静态文件列表的普通app.yaml 就足够了。
试试这个 app.yaml:
module: default
runtime: python27 # <- doesn't matter for static website, just don't think you can define java here
api_version: '1.0'
threadsafe: true
handlers:
# it's just an example, use your paths
- url: /assets
static_dir: assets
- url: /
static_files: index.html
upload: index.html
然后将其部署为:
gcloud preview app deploy path/to/app.yaml
对于这样的空应用程序,您甚至不需要启动服务器的好处是,静态文件由 Google cdn 提供。
当然,您总是可以部署一个新版本的应用程序,用 java(或 python,任何东西)实现,然后替换这个。