Local metadata link commit at 2025-06-06 15:40:57 — file:///home/mrhavens/git-local-repos/git-sigil.git
This commit is contained in:
commit
b548318725
134 changed files with 15789 additions and 0 deletions
19
src/pages/api/blog/views/[slug].json.ts
Normal file
19
src/pages/api/blog/views/[slug].json.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import type { APIRoute } from "astro";
|
||||
// import { getViewsBySlug } from "src/utils/views/turso";
|
||||
// import { getViewsBySlug } from "src/utils/views/ioredis";
|
||||
import { getViewsBySlug } from "src/utils/views/in-memory";
|
||||
|
||||
// In development/HMR, you can accidentally make this call numerous times and exceed your quota...
|
||||
// thus, the in-memory version of `getViewsBySlug` is used
|
||||
|
||||
// When deploying, and you have either `ioredis` or `turso` configured with your cloned version -
|
||||
// please uncomment the respective line
|
||||
|
||||
|
||||
export const GET: APIRoute = async ({ params, request }) => {
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
views: params.slug ? await getViewsBySlug(params.slug) : 0,
|
||||
}),
|
||||
);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue