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

worker-express

v0.1.0

Published

Express-like routing for Cloudflare Workers

Downloads

127

Readme

worker-express

Cloudflare Workers 向けの最小 Express 風ルーティングライブラリです。内部実装は TypeScript で管理し、配布物は ESM (dist/index.js) と型定義 (dist/index.d.ts) を同梱します。

インストール

npm i worker-express

最小サンプル

import express from 'worker-express';

const app = express();

app.get('/', (req, res) => {
  res.send('Hello World!');
});

export default app;

TypeScript 利用時も同じ import で型補完が有効になります。

サポート範囲

  • 実行環境: Cloudflare Workers
  • 開発 / 検証環境: Node.js LTS の最新 2 系統(現時点では 20, 22
  • 配布形式: ESM (dist/index.js) + 型定義 (dist/index.d.ts)
  • 想定用途: Workers の fetch ハンドラとして export default app する最小構成

できること

  • Cloudflare Workers で Express 風の最小ルーティングを組めます。
  • app.use() によるミドルウェア実行ができます。
  • path params と req.query を扱えます。
  • res.status(), res.set(), res.send(), res.json(), res.end() を使えます。
  • next(err) による最小の 500 応答へフォールバックできます。

既知の制約

  • express.Router()app.route() には未対応です。
  • cookie / CORS helper や static 配信は未対応です。
  • Node.js の HTTP サーバー実装としての Express 互換実行は対象外です。

Express との差分

  • Express 互換を志向しますが、完全互換ではありません。
  • 実行対象は Cloudflare Workers に限定し、Node.js の http.Server は扱いません。
  • ルーティング API は MVP の最小セットに絞っており、express.Router()app.route() は未対応です。
  • method 不一致時にコアが 405 Method Not Allowed を自動では返しません。
  • next(err) は最小の 500 応答へフォールバックし、Express の詳細なエラーハンドリング機構は未実装です。

安定性と互換性

  • 0.x 系の間は MVP として改善を優先するため、API や挙動に breaking change が入る可能性があります。
  • 互換性影響のある変更は、README・CHANGELOG・GitHub Releases で明示します。
  • 今後の予定や breaking change 候補は ROADMAP.md で管理します。

対応API(MVP)

  • express()
  • app.use(middleware)
  • app.get/post/put/patch/delete(path, ...handlers)
  • req.method, req.url, req.path, req.query, req.params, req.headers, req.body
  • res.status(code), res.set(name, value), res.send(body), res.json(data), res.end()
  • next(err) による 500 応答

Cloudflare Workers での実行

wrangler.toml 例:

name = "worker-express-example"
main = "src/index.ts"
compatibility_date = "2025-01-01"

src/index.tsexport default app すれば fetch ハンドラとして動作します。

開発方法

npm install
npm run lint
npm test

Workers 実行に近い確認は Miniflare を使った npm run test:integration で行えます。手動確認は Wrangler を使い、npm run dev:helloexamples/hello-world を起動します。

詳細ドキュメント

詳細な使い方は docs/USAGE.md を参照してください。npm 配布物にも同梱しています。

サポートと案内

  • バグ報告や機能提案は GitHub Issues を利用してください。
  • 使い方の相談や未確定な仕様の相談は GitHub Discussions を利用してください。
  • 今後の対応予定は ROADMAP.md を参照してください。

ライセンス

MIT License