Catalog npm
Back to packageRELEASE DETAILS

0.1.0

npm

404-explorer

Ultra-light zero-config helper that turns your 404s into an interactive treasure map for real routes, recent misses, and smart suggestions.

404debugexpressfastifykoamiddlewarepackageroutestest
Published28 Nov 2025
Direct dependencies0
Transitive dependenciesNot calculated

README

Current package documentation

404 Explorer(中文版)

English · 中文版本

一个零配置、超轻量的 404 调试助手。只需在 Express / Koa / Fastify 应用的末尾加上一行,就能把普通 404 页面变成“寻宝地图”,展示真实路由、最近踩空记录以及智能猜测。

核心特性

  • 自动列出项目已注册的路由
  • 基于 Levenshtein 距离的“猜你想去”提示
  • 记录最近的 404(次数 + 时间戳)
  • ?json 切换 JSON 模式,方便自动化
  • 通过 EXPLORER_404_COLOR 设置主题色

安装

npm i 404-explorer

使用方法

// Express、Koa、Fastify 等入口文件
require('404-explorer')(app)

访问不存在的地址(例如 http://localhost:3000/helo)即可看到极简 404 面板;追加 ?json 可查看同样信息的 JSON 版。

示例站点

项目自带 example/ 目录,可快速体验:

cd example
npm init -y
npm i express
node server.js

浏览器访问 http://localhost:3000/ 或任何不存在的路径,观察 404 Explorer 的交互。

可选参数

require('404-explorer')(app, {
  routes: ['/custom/list'], // 提供自定义路由列表,跳过自动发现
  router: appRouterInstance, // 传入自定义 router 以扫描路由
})

后续小升级灵感

  • 暴露 /~routes 接口,方便 CI 做死链扫描
  • 提供主题 / CSS 变量自定义
  • 导出 404 统计数据,接入监控面板

需要发布到 npm?请参考 PUBLISH.zh-CN.md。也欢迎 PR,一起保持它的“小而美” ✨

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 0

Native requirements
0 direct targetsNot calculated transitive count
No declared dependencies in this collected response

Declarations describe requirements; they are not a resolved dependency graph.

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-gO3JxZtTJh9De2K4/PkVGPKu2dQLaudi9f3iUBUE2v0rNslSomc2J6XcOy1mSFu200Hw6NdIsu/7cQYzMS82Kg==",
  "shasum": "53d2b868cfb07181773eb12f2f4f321f71396cdc",
  "tarball": "https://registry.npmjs.org/404-explorer/-/404-explorer-0.1.0.tgz",
  "fileCount": 6,
  "unpackedSize": 25006,
  "signatures": [
    {
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
      "sig": "MEUCIQCGSBMYT6sKtzWBv0pZ9RWTbjR3kAzM3yS1KB6S4nghkAIgSXaqRjJA1+ebj0+l/yV+AveLig/dqMlvFVqytTffxqg="
    }
  ]
}

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:58 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:4e21ce4077d9eade64d1a6685e561e80fc7b30cbe57b9c000406dbd58c5d2629

Other collected versions

View all collected versions →