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

Function detect

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

dependsOnFunction · 0.90
readFileMethod · 0.80
getAllFilesMethod · 0.65

Tested by

no test coverage detected