Add server routes for companies, approvals, costs, and dashboard
New routes: companies, approvals, costs, dashboard, authz. New services: companies, approvals, costs, dashboard, heartbeat, activity-log. Add auth middleware and structured error handling. Expand existing agent and issue routes with richer CRUD operations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,27 +3,37 @@ import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import type { Db } from "@paperclip/db";
|
||||
import { httpLogger, errorHandler } from "./middleware/index.js";
|
||||
import { actorMiddleware } from "./middleware/auth.js";
|
||||
import { healthRoutes } from "./routes/health.js";
|
||||
import { companyRoutes } from "./routes/companies.js";
|
||||
import { agentRoutes } from "./routes/agents.js";
|
||||
import { projectRoutes } from "./routes/projects.js";
|
||||
import { issueRoutes } from "./routes/issues.js";
|
||||
import { goalRoutes } from "./routes/goals.js";
|
||||
import { approvalRoutes } from "./routes/approvals.js";
|
||||
import { costRoutes } from "./routes/costs.js";
|
||||
import { activityRoutes } from "./routes/activity.js";
|
||||
import { dashboardRoutes } from "./routes/dashboard.js";
|
||||
|
||||
export function createApp(db: Db, opts: { serveUi: boolean }) {
|
||||
const app = express();
|
||||
|
||||
app.use(express.json());
|
||||
app.use(httpLogger);
|
||||
app.use(actorMiddleware(db));
|
||||
|
||||
// Mount API routes
|
||||
const api = Router();
|
||||
api.use("/health", healthRoutes());
|
||||
api.use("/agents", agentRoutes(db));
|
||||
api.use("/projects", projectRoutes(db));
|
||||
api.use("/issues", issueRoutes(db));
|
||||
api.use("/goals", goalRoutes(db));
|
||||
api.use("/activity", activityRoutes(db));
|
||||
api.use("/companies", companyRoutes(db));
|
||||
api.use(agentRoutes(db));
|
||||
api.use(projectRoutes(db));
|
||||
api.use(issueRoutes(db));
|
||||
api.use(goalRoutes(db));
|
||||
api.use(approvalRoutes(db));
|
||||
api.use(costRoutes(db));
|
||||
api.use(activityRoutes(db));
|
||||
api.use(dashboardRoutes(db));
|
||||
app.use("/api", api);
|
||||
|
||||
// SPA fallback for serving the UI build
|
||||
|
||||
Reference in New Issue
Block a user