import { Router } from 'express'; import { ownerOnly } from '../auth/owner.js'; import { errorMiddleware, NotFoundError } from './errors.js'; export function mountApi(app) { const api = Router(); api.use(ownerOnly); // route modules registered here as Plan 2 progresses api.use((_req, _res, next) => next(new NotFoundError('route not found'))); api.use(errorMiddleware); app.use('/api', api); return api; }