MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / constructor

Method constructor

packages/backend/src/api.ts:22–48  ·  view source on GitHub ↗
(
        promClient: PromClient,
        private prisma: PrismaClient,
        private connectionManager: ConnectionManager,
        private repoIndexManager: RepoIndexManager,
        private accountPermissionSyncer: AccountPermissionSyncer,
    )

Source from the content-addressed store, hash-verified

20 private server: http.Server;
21
22 constructor(
23 promClient: PromClient,
24 private prisma: PrismaClient,
25 private connectionManager: ConnectionManager,
26 private repoIndexManager: RepoIndexManager,
27 private accountPermissionSyncer: AccountPermissionSyncer,
28 ) {
29 const app = express();
30 app.use(express.json());
31 app.use(express.urlencoded({ extended: true }));
32
33 // Prometheus metrics endpoint
34 app.use('/metrics', async (_req: Request, res: Response) => {
35 res.set('Content-Type', promClient.registry.contentType);
36 const metrics = await promClient.registry.metrics();
37 res.end(metrics);
38 });
39
40 app.post('/api/sync-connection', this.syncConnection.bind(this));
41 app.post('/api/index-repo', this.indexRepo.bind(this));
42 app.post('/api/trigger-account-permission-sync', this.triggerAccountPermissionSync.bind(this));
43 app.post(`/api/experimental/add-github-repo`, this.experimental_addGithubRepo.bind(this));
44
45 this.server = app.listen(PORT, () => {
46 logger.debug(`API server is running on port ${PORT}`);
47 });
48 }
49
50 private async syncConnection(req: Request, res: Response) {
51 const schema = z.object({

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected