0.0.16 • Published 3 years ago

solid-start-trpc v0.0.16

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years 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

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago