Module

x/kyuko/mod.ts>Kyuko

Fast and easy http framework for Deno Deploy 🦕
Latest
class Kyuko
import { Kyuko } from "https://dotland.deno.dev/x/kyuko@v0.6.3/mod.ts";

An ultra-light framework for http servers hosted on Deno Deploy. Visit the guide for more information.

Constructors

new
Kyuko()

Initializes a new Kyuko app.

Methods

private
handleError(
err: Error,
)
private
handleFetchEvent(event: FetchEvent)
all(routePath: string, handler: KyukoRouteHandler)

Registers a handler that is invoked when any type of requests are made to url paths that match the routePath.

Registers a default handler that is invoked when a request isn't caught by any other custom handlers.

delete(routePath: string, handler: KyukoRouteHandler)

Registers a handler that is invoked when DELETE requests are made to url paths that match the routePath.

error(errorHandler: KyukoErrorHandler)

Adds errorHandler to a list of application-level error handlers. Error handlers are invoked in order of addition via error().

Note that in Express, you call use() instead.

get(routePath: string, handler: KyukoRouteHandler)

Registers a handler that is invoked when GET requests are made to url paths that match the routePath.

app.get('/', (req, res) => {
  const { name } = req.query;
  res.send(`Hello ${name}!`);
});
head(routePath: string, handler: KyukoRouteHandler)

Registers a handler that is invoked when HEAD requests are made to url paths that match the routePath.

app.head("/", (_, res) => {
  res.headers.append("content-type", "text/plain;charset=UTF-8");
  res.headers.append("content-length", "12");
  res.send();
});
listen(callback?: VoidFunction)

Starts listening to 'fetch' requests.

patch(routePath: string, handler: KyukoRouteHandler)

Registers a handler that is invoked when PATCH requests are made to url paths that match the routePath.

post(routePath: string, handler: KyukoRouteHandler)

Registers a handler that is invoked when POST requests are made to url paths that match the routePath.

put(routePath: string, handler: KyukoRouteHandler)

Registers a handler that is invoked when PUT requests are made to url paths that match the routePath.

app.put('/users/:id', (req, res) => {
  const { id } = req.params;

  // ...

  res.status(204).send(`Updated ${id}!`);
});
use(middleware: KyukoMiddleware)

Adds middleware to a list of application-level middleware to run. Middleware are invoked in order of addition via use().