MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / detect

Function detect

src/resolution/frameworks/express.ts:127–147  ·  view source on GitHub ↗
(context: ResolutionContext)

Source from the content-addressed store, hash-verified

125 languages: ['javascript', 'typescript'],
126
127 detect(context: ResolutionContext): boolean {
128 // Express in a package.json — the root's, or a workspace's (`backend/`, `apps/api/`).
129 if (dependsOn(context, 'express', 'fastify', 'koa', 'hapi', '@hapi/hapi')) return true;
130
131 // Check for common Express patterns
132 const allFiles = context.getAllFiles();
133 for (const file of allFiles) {
134 if (
135 file.includes('routes') ||
136 file.includes('controllers') ||
137 file.includes('middleware')
138 ) {
139 const content = context.readFile(file);
140 if (content && (content.includes('express') || content.includes('app.get') || content.includes('router.get'))) {
141 return true;
142 }
143 }
144 }
145
146 return false;
147 },
148
149 resolve(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null {
150 // A JS/TS module reaches another file's middleware, controller or service

Callers

nothing calls this directly

Calls 3

dependsOnFunction · 0.90
getAllFilesMethod · 0.65
readFileMethod · 0.65

Tested by

no test coverage detected