Catalog npm
PACKAGE EXPLORERView in registry

404-explorer

npm

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

404debugexpressfastifykoamiddlewarepackageroutestest
Versions collected1
Direct dependencies0From release 0.1.0
Last observed20 Oct, 19:58 UTC

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.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.0Registry latest28 Nov 20250

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

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:1d973af0ab290376bb8ef2c7c91dabdfb1257b82a28ec5a952741eb2482f9e8c