mirror of
https://github.com/only-cli/oc.git
synced 2026-09-15 10:40:56 +02:00
nodejs.org has no search results page: the site's search box is a JavaScript modal asking a third-party service, so the search verb went through DuckDuckGo. But the API docs publish their entire reference as one static JSON file, all.json, much the way a Sphinx site publishes its search index, so a new nodedoc backend ranks that file locally: every module, class, method, property, and event heading becomes a result linking to its own anchor, and oc node search prints them as a normal numbered page. The file is ~8MB (~1MB over the wire) and static, so the day cache the Sphinx backend used moves to a shared cache module both backends call: one directory per backend, one file per host, parsed before written so a block page never poisons it. A typical result list costs under 100 tokens and answers from disk in under 100ms once cached.
8 lines
207 B
JSON
8 lines
207 B
JSON
{
|
|
"domain": "nodejs.org",
|
|
"commands": {
|
|
"api": { "open": "https://nodejs.org/api/{module}.html", "args": ["module"] },
|
|
"search": { "nodedoc": "https://nodejs.org/api/", "args": ["query"] }
|
|
}
|
|
}
|