feat: add loading of recommendations to movie page

This commit is contained in:
2023-09-08 16:52:26 +02:00
parent 04c3578d61
commit 67c2785b80
9 changed files with 269 additions and 47 deletions

View File

@ -0,0 +1,17 @@
import { Handlers } from "$fresh/server.ts";
import { AccessDeniedError } from "@lib/errors.ts";
import { getSimilarMovies } from "@lib/recommendation.ts";
import { json } from "@lib/helpers.ts";
export const handler: Handlers = {
async GET(_, ctx) {
const session = ctx.state.session;
if (!session) {
throw new AccessDeniedError();
}
const recommendations = await getSimilarMovies(ctx.params.id);
return json(recommendations);
},
};