@taggor/server 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
The helper a site with a server uses to put a Taggor component in its first HTML response. One function,
|
|
4
4
|
no dependency, no framework: the result is a string.
|
|
5
5
|
|
|
6
|
-
>
|
|
6
|
+
> If the site has no server key, `render`
|
|
7
7
|
> returns the bare tag, which is what the page has without it, so installing this package changes nothing on
|
|
8
8
|
> your site. The docs page for server-side rendering is at <https://taggor.dev/docs/ssr/>.
|
|
9
9
|
|
|
@@ -13,9 +13,9 @@ no dependency, no framework: the result is a string.
|
|
|
13
13
|
(`GET <origin>/r/<siteKey>/<tag>?<attributes>`, with the site's server key as `Authorization: Bearer <key>`)
|
|
14
14
|
and returns HTML to write where the tag would go: the element
|
|
15
15
|
with its shadow root already filled, which a browser shows before any script. The site's snippet stays as it is;
|
|
16
|
-
the Taggor runtime takes over the elements already on the screen. Whatever goes wrong (Taggor slow or down,
|
|
17
|
-
|
|
18
|
-
the browser as it
|
|
16
|
+
the Taggor runtime takes over the elements already on the screen. Whatever goes wrong (Taggor slow or down, a
|
|
17
|
+
component that cannot render on a server) it returns the bare tag, and the component renders in
|
|
18
|
+
the browser as it does with the snippet alone.
|
|
19
19
|
|
|
20
20
|
## Use
|
|
21
21
|
|
|
@@ -50,7 +50,7 @@ anything the network or Taggor does.
|
|
|
50
50
|
|
|
51
51
|
## The server key
|
|
52
52
|
|
|
53
|
-
The site key is public; the server key is a secret, so only
|
|
53
|
+
The site key is public; the server key is a secret, so only your servers spend the site's server
|
|
54
54
|
renders. Create it on the site's Install > SSR tab in the portal (or `POST /v1/sites/{site_id}/server-keys`);
|
|
55
55
|
it is shown once. Put it in the server's environment as `TAGGOR_SERVER_KEY` and never in browser code, the
|
|
56
56
|
page, a public environment variable or the repository. A site without a key gets no server rendering, and a
|
|
@@ -115,9 +115,9 @@ app.get("/", async (_request, response) => {
|
|
|
115
115
|
});
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
-
**Plain PHP, over HTTP
|
|
118
|
+
**Plain PHP, over HTTP.** Any language can do what the helper does: one request with the
|
|
119
119
|
server key in an `Authorization: Bearer` header (never in the URL) and a short timeout; if the answer is `200`,
|
|
120
|
-
`text/html`, starts with `<tag` and ends with `</tag>`, write the body, otherwise the bare tag. This
|
|
120
|
+
`text/html`, starts with `<tag` and ends with `</tag>`, write the body, otherwise the bare tag. This function follows
|
|
121
121
|
that rule.
|
|
122
122
|
|
|
123
123
|
```php
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taggor/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Server helper for sites that render HTML on a server: asks the Taggor edge for a component's server-rendered fragment and falls back to the bare tag.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"taggor",
|