-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b5b34fe
commit 62004a0
Showing
20 changed files
with
1,541 additions
and
739 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
{ | ||
"type": "module", | ||
"dependencies": { | ||
"@prismicio/client": "^5.0.0", | ||
"node-fetch": "^2.6.1", | ||
"quick-lru": "^6.0.0" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Server Usage | ||
|
||
This example shows how to use `@prismicio/client` on the server. Usage is | ||
identical to usage in the browser, except for the need to provide a `fetch()` | ||
function. | ||
|
||
In this example, we're using a library called [node-fetch][node-fetch] to make | ||
network requests. This is a nearly drop-in Node.js implementation for the | ||
browser's `fetch()` function. | ||
|
||
For our use-case, its only limitation is the lack of built-in caching. If you | ||
are running in a serverless architecture where instances are started and stopped | ||
per-request, caching is unnecessary. If you are running on a long-living server, | ||
caching would be beneficial. See the [Custom Caching](../custom-caching) example | ||
to see how to setup caching. | ||
|
||
## How to run the example | ||
|
||
```sh | ||
# Clone the repository to your computer | ||
git clone https://github.com/prismicio/prismic-javascript.git | ||
cd prismic-javascript/examples/server-usage | ||
|
||
# Install the dependencies | ||
npm install | ||
|
||
# Run the example | ||
node index.js | ||
``` | ||
|
||
[node-fetch]: https://github.com/node-fetch/node-fetch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.