Restructure Project Architecture with Modular Routes and Configuration

- Refactored main application entry point to use centralized configuration
- Created modular route structure with separate files for different API endpoints
- Introduced app.config.ts for centralized environment variable management
- Moved tools and route logic into dedicated files
- Simplified index.ts and improved overall project organization
- Added comprehensive type definitions for tools and API interactions
This commit is contained in:
jango-blockchained
2025-02-03 15:39:19 +01:00
parent 18f09bb5ce
commit 397355c1ad
20 changed files with 1664 additions and 1341 deletions

39
src/routes/index.ts Normal file
View File

@@ -0,0 +1,39 @@
/**
* API Routes Module
*
* This module exports the main router that combines all API routes
* into a single router instance. Each route group is mounted under
* its respective path prefix.
*
* @module routes
*/
import { Router } from 'express';
import { mcpRoutes } from './mcp.routes';
import { sseRoutes } from './sse.routes';
import { toolRoutes } from './tool.routes';
import { healthRoutes } from './health.routes';
/**
* Create main router instance
* This router will be mounted at /api in the main application
*/
const router = Router();
/**
* Mount all route groups
* - /mcp: MCP schema and execution endpoints
* - /sse: Server-Sent Events endpoints
* - /tools: Tool management endpoints
* - /health: Health check endpoint
*/
router.use('/mcp', mcpRoutes);
router.use('/sse', sseRoutes);
router.use('/tools', toolRoutes);
router.use('/health', healthRoutes);
/**
* Export the configured router
* This will be mounted in the main application
*/
export { router as apiRoutes };