class

Analyzer::Javascript::Egg

Inherits Analyzer::Javascript::JavascriptEngine < Analyzer < FileHelper < Reference < Object

Egg.js registers routes in app/router.{js,ts} (and the app/router/** files it requires) against controllers loaded from app/controller/**, addressed by their camelCased file path:

router.get('/users/:id', controller.admin.userInfo.show) → method show of app/controller/admin/user_info.js

The controller method's body supplies the request params.

Constants

CONTROLLER_DIR = "/app/controller/"
CONTROLLER_REF = /\A(?:app\.|this\.)?controller\.([\w$.]+)\z/
PACKAGE_MARKERS = ["\"egg\":", "\"egg-core\":", "\"egg-bin\":", "\"@eggjs/bin\":"]

egg-bin / @eggjs/bin is the dev runner; "egg" also matches the package.json "egg": { ... } config block.

RESOURCE_ACTIONS = {"index" => {["GET"], ""}, "new" => {["GET"], "/new"}, "create" => {["POST"], ""}, "show" => {["GET"], "/:id"}, "edit" => {["GET"], "/:id/edit"}, "update" => {["PATCH", "PUT"], "/:id"}, "destroy" => {["DELETE"], "/:id"}}

egg-core's REST_MAP: action → verbs and path suffix. Only the actions the controller defines are registered.

ROUTER_FILE = /\/app\/router(?:\/.+)?\.[cm]?[jt]s$/

Class methods

tech_name
Source

Instance methods

analyze
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source

Nested types