-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServer.js
More file actions
31 lines (25 loc) · 827 Bytes
/
Server.js
File metadata and controls
31 lines (25 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import path from "node:path";
import { RegistryService } from "./Services/RegistryService.js";
import { handleRequest } from "./Router.js";
const projectRoot = path.resolve(import.meta.dir);
const dataDir = path.join(projectRoot, "Data");
const registryDir = path.join(projectRoot, "registry");
const port = Number(process.env.PORT || process.env.SUPERHUB_PORT || 3005);
const registry = new RegistryService({
projectRoot,
dataDir,
registryDir
});
await registry.init();
const verifySummary = await registry.verifyLocalRegistry();
const services = {
registry
};
const server = Bun.serve({
port,
async fetch(request) {
return handleRequest(request, { services, projectRoot });
}
});
console.log("[superhub] local registry boot verify:", verifySummary);
console.log(`[superhub] listening on port ${server.port}`);