feat(api): spaces routes

Add lib/api/routes/spaces.js: list, create, get-by-id, get-by-slug,
patch, delete. Mounted under /api/spaces. Server smoke restored.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
root
2026-05-31 16:38:23 +10:00
parent 75afedaef0
commit ebb1e836ca
4 changed files with 158 additions and 1 deletions

View File

@@ -1,12 +1,13 @@
import { Router } from 'express';
import { ownerOnly } from '../auth/owner.js';
import { errorMiddleware, NotFoundError } from './errors.js';
import { router as spacesRouter } from './routes/spaces.js';
export function mountApi(app) {
const api = Router();
api.use(ownerOnly);
// route modules registered here as Plan 2 progresses
api.use('/spaces', spacesRouter);
api.use((_req, _res, next) => next(new NotFoundError('route not found')));