0.0.16 • Published 1 year ago

solid-start-trpc v0.0.16

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Base

import { createSolidAPIHandler } from "solid-start-trpc";

const handler = createSolidAPIHandler({
  router: appRouter,
  createContext: () => null,
});
export const get = handler;
export const post = handler;

// for version 0.1.6 +
export const GET = handler;
export const POST = handler;

Ctx

const createContext = (opts) => ({ req: opts.req, res: opts.res });

Response Meta

const handler = createSolidAPIHandler({
  router: appRouter,
  createContext,
  responseMeta: ({ ctx }) => {
    if (ctx?.req.headers.get("x-random-header")) {
      return {
        headers: {
          "x-random-header": `hello-${ctx.req.headers.get("x-random-header")}`,
        },
      };
    }
    return {};
  },
});
0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago