chore: initial commit for phase03
This commit is contained in:
@@ -4,6 +4,10 @@ import cookie from '@fastify/cookie';
|
||||
import dbPlugin from './plugins/db.js';
|
||||
import authPlugin from './plugins/auth.js';
|
||||
import authRoutes from './routes/auth/index.js';
|
||||
import organizationRoutes from './routes/organizations/index.js';
|
||||
import nodeRoutes from './routes/nodes/index.js';
|
||||
import serverRoutes from './routes/servers/index.js';
|
||||
import adminRoutes from './routes/admin/index.js';
|
||||
import { AppError } from './lib/errors.js';
|
||||
|
||||
const app = Fastify({
|
||||
@@ -56,6 +60,17 @@ app.get('/api/health', async () => {
|
||||
});
|
||||
|
||||
await app.register(authRoutes, { prefix: '/api/auth' });
|
||||
await app.register(organizationRoutes, { prefix: '/api/organizations' });
|
||||
await app.register(adminRoutes, { prefix: '/api/admin' });
|
||||
|
||||
// Nested org routes: nodes and servers are scoped to an org
|
||||
await app.register(
|
||||
async (orgScope) => {
|
||||
await orgScope.register(nodeRoutes, { prefix: '/nodes' });
|
||||
await orgScope.register(serverRoutes, { prefix: '/servers' });
|
||||
},
|
||||
{ prefix: '/api/organizations/:orgId' },
|
||||
);
|
||||
|
||||
// Start
|
||||
const PORT = Number(process.env.PORT) || 3000;
|
||||
|
||||
Reference in New Issue
Block a user