npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nwire/express

v0.15.1

Published

Nwire — Express-backed HTTP adopter. expressAdapter() consumes wires with binding.$adapter==='http' and mounts them on an Express server; fromExpressMiddleware() bridges Express middleware into httpKoa's middleware chain.

Readme

@nwire/express

Express-backed HTTP adopter — same wires as @nwire/koa, different runtime.

pnpm add @nwire/express @nwire/app @nwire/endpoint @nwire/wires

express@^4 || ^5 is a peer dep.

Two integration modes

1. Drive Nwire as the HTTP server (Adapter mode)

import { createApp } from "@nwire/app";
import { endpoint } from "@nwire/endpoint";
import { post } from "@nwire/wires/http";
import { expressAdapter } from "@nwire/express";
import { z } from "zod";

const app = createApp({ appName: "api" });
app.wire(post("/hello", { body: z.object({ name: z.string() }) }), async (input) => ({
  message: `Hello, ${input.name}!`,
}));

await endpoint("api", { port: 3000 })
  .use(expressAdapter({ prefix: "/api" }))
  .mount(app)
  .run();

2. Mount Nwire wires inside an existing Express app

When you already run Express (or NestJS, which uses Express under the hood), nwireToExpressRouter extracts wired routes as an Express Router you mount alongside legacy handlers. Migration without rewrite.

import express from "express";
import { createApp } from "@nwire/app";
import { nwireToExpressRouter } from "@nwire/express";

const legacy = express();
legacy.get("/legacy", legacyHandler);

const nwireApp = createApp({ appName: "orders" });
nwireApp.wire(/* ... */);
await nwireApp.start();

legacy.use("/api/nwire", nwireToExpressRouter(nwireApp));
legacy.listen(3000);

The router handles its own JSON body-parsing (bodyParser: false opts out) so it works whether Express has body-parser globally or not. See examples/nest-interop for the full Nwire-inside-NestJS pattern.

Adopter config

expressAdapter({
  port: 3000, // 0 = ephemeral; .port() returns the bound port
  host: "0.0.0.0",
  prefix: "/api",
  middleware: [helmet(), morgan("combined")],
  logger: myLogger,
});

Bridging middleware

fromExpressMiddleware(mw) wraps an Express middleware so it can be passed in httpKoa({ middleware: [...] }) — useful when an Express-only middleware (e.g., a vendored auth check) needs to run inside a Koa-backed adopter.

Related