class

Detector::Javascript::Express

Inherits Detector < Reference < Object

Constants

SIGNAL = Regex.union(/require\(['"]express['"]\)/, /from ['"]express['"]/, /app\.use\(express\.json\(\)\)/, /app\.use\(express\.urlencoded\(\{ extended: true \}\)\)/)

Single precompiled alternation — one PCRE2 scan over the file instead of up to four separate .match passes. Regex.union wraps each branch verbatim, so the boolean result is identical.

SOURCE_EXTENSIONS = [".js", ".mjs", ".cjs", ".jsx", ".ts", ".tsx"] of ::String

Mirrors the extensions: list above. The two drifted before: the gate admitted .jsx/.tsx, this guard did not, so a project whose only Express source was a .jsx file reported "No technologies detected" while the analyzer was perfectly able to parse it.

Class methods

tech_name

The tech name without needing an instance, so the registry can be read off the classes themselves rather than from a parallel list.

Source

Instance methods

applicable?(filename : String) : Bool

No basenames: %w[package.json]: "express": "^4.x" in a manifest is not evidence of a hand-written Express app, because Feathers, Sails and NestJS all carry Express as a transitive dependency. Detection stays source-only. The declaration used to be there and was dead anyway — detect rejected every non-source filename — so dropping it changes no result, it just stops handing package.json to a detect that always answered false.

Source
detect(filename : String, file_contents : String) : Bool
Source
set_name

No basenames: %w[package.json]: "express": "^4.x" in a manifest is not evidence of a hand-written Express app, because Feathers, Sails and NestJS all carry Express as a transitive dependency. Detection stays source-only. The declaration used to be there and was dead anyway — detect rejected every non-source filename — so dropping it changes no result, it just stops handing package.json to a detect that always answered false.

Source