Other frameworks
Pull Inkies articles with REST and render them in Astro, Nuxt, SvelteKit, Rails, or another framework.
Inkies works with any server-rendered application that can make HTTPS requests. The API is useful from Astro, Nuxt, SvelteKit, Rails, and similar frameworks.
REST with curl
Set the API base URL to the Convex site URL shown in the dashboard Publishing card:
curl \
-H "Authorization: Bearer $INKIES_API_KEY" \
"$INKIES_API_URL/api/v1/site"List published article summaries:
curl \
-H "Authorization: Bearer $INKIES_API_KEY" \
"$INKIES_API_URL/api/v1/articles?limit=20"Fetch one article:
curl \
-H "Authorization: Bearer $INKIES_API_KEY" \
"$INKIES_API_URL/api/v1/articles/a-published-slug"REST with fetch
const response = await fetch(`${process.env.INKIES_API_URL}/api/v1/articles`, {
headers: {
Authorization: `Bearer ${process.env.INKIES_API_KEY}`,
},
});
if (!response.ok) {
throw new Error(`Inkies request failed: ${response.status}`);
}
const page: {
articles: Array<{
slug: string;
title: string;
description: string;
publishedAt: string;
updatedAt: string;
coverImage: {
url: string;
alt: string;
width: number;
height: number;
} | null;
keyword: string;
}>;
nextCursor: string | null;
} = await response.json();Fetch the detail response by slug. The detail response adds intent, markdown, html, sources, and internalLinks.
const articleResponse = await fetch(
`${process.env.INKIES_API_URL}/api/v1/articles/${encodeURIComponent(slug)}`,
{
headers: {
Authorization: `Bearer ${process.env.INKIES_API_KEY}`,
},
},
);
const article = await articleResponse.json();Render the returned html in the framework's trusted HTML mechanism. For example, a React application can use dangerouslySetInnerHTML={{ __html: article.html }}. Do not interpolate untrusted user input into the response outside your framework's normal HTML safety boundary.
Caching
The API returns Cache-Control: no-store. Cache the response at your build or ISR layer when the framework supports it. For a build-time site, fetch articles during the build. For a server-rendered site, use the framework's route or data cache around the request instead of relying on the API response to be cached by an intermediary.