Skip to content

Commit

Permalink
Damn I love Fastify
Browse files Browse the repository at this point in the history
  • Loading branch information
MotorTruck1221 committed Dec 21, 2024
1 parent 967bc5a commit 5c3e698
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,22 @@ await app.register(fastifyCookie, {
await app.register(fastifyCompress, {
encodings: ['br', 'gzip', 'deflate']
});
await app.register(fastifyStatic, {
root: `${Deno.cwd()}/dist`
});

if (parsedDoc.seo.enabled && !parsedDoc.seo.both || !parsedDoc.seo.enabled) {
await app.register(fastifyStatic, {
root: `${Deno.cwd()}/dist`
});
} else {
await app.register(fastifyStatic, {
root: `${Deno.cwd()}/dist/noseo`,
});
await app.register(fastifyStatic, {
root: `${Deno.cwd()}/dist/seo`,
constraints: { host: new URL(parsedDoc.seo.domain).host },
decorateReply: false
})
}

await app.register(fastifyMiddie);
await app.register(fastifyHttpProxy, {
upstream: 'https://rawcdn.githack.com/ruby-network/ruby-assets/main/',
Expand Down

0 comments on commit 5c3e698

Please sign in to comment.