Reputation: 310
I want to deploy a Polymer web app.
Since Polymer seems to manage routing with <app-route>
, can I just install the Polymer CLI on my server and run polymer serve
? Or should I make a backend, and if so, how do I tie it to the Polymer frontend?
Upvotes: 3
Views: 593
Reputation: 130
polymer-cli
is great for generating apps hosted under the root path /
, but not under any subroot like app/
or shop-app/
, because is uses absolute paths in its build process. <app-route>
seems to be the right way to go, but configuring it via polymer-cli
is not yet supported. The idea is to use a separate server for every app running under the root path. See related Stackoverflow Post Serving Polymer App to a /path not at root and Polymer Blog Post Encapsulated Routing with Elements: An overview to doing distributed routing in an application, as well as an introduction to <app-route>
and <app-location>
Upvotes: 1
Reputation: 1093
No need to install polymer-cli
on your server.
Just follow the steps on https://www.polymer-project.org/1.0/docs/tools/polymer-cli#build.
So you should use polymer build --entrypoint index.html
to build your application for production.
Afterwards in /build/
folder you get two folders: bundled
and unbundled
.
Quoted from polymer-project.org:
bundled. All fragments are bundled together to reduce the number of file requests. Optimal for sending to clients or serving from servers that are not HTTP/2 compatible.
unbundled. Fragments are unbundled. Optimal for HTTP/2-compatible servers and clients.
Just upload the contents of one of them to your server and your application will be served.
Upvotes: 2