inkan

Nuxt, SvelteKit, Astro, Remix

Frameworks that need no package: app.fetch is enough.

Frameworks that hand their server routes a web Request and want a Response need no package: that is what app.fetch does. Keep the app's routes, docs, document and inspector under the prefix the framework routes to it, so every link on the docs page points there:

// server/app.ts, the same in every recipe
import { , ,  } from "@vxnsin/inkan";

const  = (() => {
  .("/teas/:id", { : .({ : .() }) }, ({  }) => findTea(.));
});

export const  = ({ : "/api/docs", : "/api/openapi.json", : "/api/_inkan" })
  .(, {}, { : "/api" });

The inspector only answers a loopback address. Pass { remote } where the framework knows who is asking, or leave it out and the inspector stays shut.

Nuxt

// server/routes/api/[...path].ts
import {  } from "~/server/app";

export default defineEventHandler(() => .(toWebRequest(), { : getRequestIP() }));

SvelteKit

// src/routes/api/[...path]/+server.ts
import {  } from "$lib/server/app";
import type {  } from "./$types";

const :  = ({ ,  }) => .(, { : () });
export const  = ,  = ,  = ,  = ,  = ,  = ;

Astro

// src/pages/api/[...path].ts   (with an adapter, in server or hybrid output)
import type {  } from "astro";
import {  } from "../../server/app";

export const  = false;
export const :  = ({ ,  }) => .(, { :  });

Remix / React Router

// app/routes/api.$.ts
import type { ,  } from "react-router";
import {  } from "~/server/app";

export const  = ({  }: ) => .();
export const  = ({  }: ) => .();

Next.js

Use @inkanjs/next: one line for every method.

On this page