StackpressGitHub

API reference

stackpress/whatwg

stackpress/whatwg exposes the WHATWG request/response variant of the Stackpress server runtime. Use it when your runtime is naturally built around Request, Response, URL, and stream primitives from the WHATWG model.

Import

import { server, router, gateway, handler } from 'stackpress/whatwg';

When To Use It

Use this path when you want the Stackpress server runtime but your environment is closer to fetch-style request and response objects than Node HTTP objects.

Export Inventory

ExportKindPurpose
server, router, gateway, handlerfunctionsCreate WHATWG-oriented server pieces
Request, Response, Router, Server, Routeruntime typesCore WHATWG runtime shapes
ConfigLoader, PluginLoaderclassesLoad config and plugin modules
ActionRouter, EntryRouter, ImportRouter, ViewRouterclassesResolve lifecycle route tasks
reqToURL, reqQueryToObject, readableToReadableStreamhelpersConvert WHATWG requests and streams

Detailed Exports

server

  • Kind: function
  • Signature shape: server(options?)
  • Returns a WhatwgServer instance.
  • Use it when you want a fetch-style Stackpress server bootstrap.
import { server } from 'stackpress/whatwg';

const app = server();

router

  • Kind: function
  • Returns a WhatwgRouter.
import { router } from 'stackpress/whatwg';

const routes = router();

gateway and handler

  • Kind: functions
  • Use them to adapt incoming WHATWG-style request handlers into the Stackpress runtime pipeline.
import { gateway, handler } from 'stackpress/whatwg';

reqToURL

  • Kind: function
  • Use it to derive a URL from an incoming WHATWG request object.
  • Returns a URL object.
import { reqToURL } from 'stackpress/whatwg';

reqQueryToObject

  • Kind: function
  • Use it to convert request query parameters into a plain object.
  • Returns an object representation of the query.
import { reqQueryToObject } from 'stackpress/whatwg';

readableToReadableStream

  • Kind: function
  • Use it to bridge Node-readable content into a WHATWG ReadableStream.
  • Returns a WHATWG-compatible readable stream.
import { readableToReadableStream } from 'stackpress/whatwg';