MCPcopy
hub / github.com/QwikDev/qwik / qwikPlugin

Function qwikPlugin

starters/adapters/fastify/src/plugins/fastify-qwik.ts:17–50  ·  view source on GitHub ↗
(
  fastify,
  options,
)

Source from the content-addressed store, hash-verified

15const { router, notFound } = createQwikCity({ render, qwikCityPlan });
16
17const qwikPlugin: FastifyPluginAsync<FastifyQwikOptions> = async (
18 fastify,
19 options,
20) => {
21 const { buildDir, distDir, assetsDir } = options;
22
23 fastify.register(fastifyStatic, {
24 root: buildDir,
25 prefix: "/build",
26 immutable: true,
27 maxAge: "1y",
28 decorateReply: false,
29 });
30
31 fastify.register(fastifyStatic, {
32 root: assetsDir,
33 prefix: "/assets",
34 immutable: true,
35 maxAge: "1y",
36 });
37
38 fastify.register(fastifyStatic, {
39 root: distDir,
40 redirect: false,
41 decorateReply: false,
42 });
43
44 fastify.removeAllContentTypeParsers();
45
46 fastify.setNotFoundHandler(async (request, response) => {
47 await router(request.raw, response.raw, (err) => fastify.log.error(err));
48 await notFound(request.raw, response.raw, (err) => fastify.log.error(err));
49 });
50};
51
52export default fastifyPlugin(qwikPlugin, { fastify: ">=4.0.0 <6.0.0" });

Callers

nothing calls this directly

Calls 2

routerFunction · 0.50
notFoundFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…