solid-start-trpc
TypeScript icon, indicating that this package has built-in type declarations

0.0.16 • Public • Published

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 {};
  },
});

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.1678latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.1678
0.0.130
0.0.120
0.0.110
0.0.100
0.0.91
0.0.80
0.0.30

Package Sidebar

Install

npm i solid-start-trpc

Weekly Downloads

79

Version

0.0.16

License

ISC

Unpacked Size

19.8 kB

Total Files

11

Last publish

Collaborators

  • orjdev