Resolve font file from node_modules in route handler
Unanswered
pjeweb posted this in #help-forum
![Avatar](https://cdn.discordapp.com/avatars/114708112623140864/755e5d5ca487baf8096f4aa26de09646.webp?size=256)
pjewebOP
Is there a cleaner way to resolve the path to a file in node_modules (or somewhere else for that matter) from a deeply nested route handler (
src/app/api/og/[event]/[userName]/route.ts
)? Right now I have a bunch of ../
to get to the root of the project. const fontPtSansBold = await fetch(
new URL(
"../../../../../../node_modules/@fontsource/pt-sans/files/pt-sans-latin-700-normal.woff",
import.meta.url,
),
).then((res) => res.arrayBuffer());