-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Angelo Ashmore <[email protected]>
- Loading branch information
1 parent
81ab2bf
commit 0801785
Showing
3 changed files
with
12 additions
and
16 deletions.
There are no files selected for viewing
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,29 +1,29 @@ | ||
# `endpoint` must use CDN | ||
|
||
`@prismicio/client` uses either a repository name or a repository endpoint to query content from Prismic. | ||
`@prismicio/client` uses either a Prismic repository name or a Prismic Rest API v2 repository endpoint to query content from Prismic. | ||
|
||
The repository name or repository endpoint must be provided when creating a `@prismicio/client` like the following: | ||
|
||
```typescript | ||
import * as prismic from "@prismicio/client"; | ||
|
||
// Using the repository name | ||
const client = prismic.createClient("example") | ||
const client = prismic.createClient("example-prismic-repo") | ||
|
||
// Using the repository endpoint | ||
const client = prismic.createClient("https://example.cdn.prismic.io/api/v2") | ||
const client = prismic.createClient("https://example-prismic-repo.cdn.prismic.io/api/v2") | ||
``` | ||
|
||
When creating a `@prismicio/client` with a repository endpoint, endpoint's subdomain must feature the `.cdn` suffix. | ||
When creating a `@prismicio/client` with a repository endpoint, the endpoint's subdomain must feature the `.cdn` suffix. | ||
|
||
```typescript | ||
import * as prismic from "@prismicio/client"; | ||
|
||
// ✅ Correct | ||
const client = prismic.createClient("https://example.cdn.prismic.io/api/v2") | ||
const client = prismic.createClient("https://example-prismic-repo.cdn.prismic.io/api/v2") | ||
|
||
// ❌ Incorrect | ||
const client = prismic.createClient("https://example.prismic.io/api/v2") | ||
const client = prismic.createClient("https://example-prismic-repo.prismic.io/api/v2") | ||
``` | ||
|
||
Not using the `.cdn` version of your repository endpoint can have unexpected side-effects and cause performance issues when query Prismic. | ||
Not using the `.cdn` version of your repository endpoint can have unexpected side-effects and cause performance issues when querying Prismic. |
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