mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-29 04:32:57 +00:00
Organize community plugins by what Paseo does and verify the category layout with a static registry fixture.
15 lines
641 B
JavaScript
15 lines
641 B
JavaScript
import { createServer } from "node:http";
|
|
import registry from "./registry.fixture.json" with { type: "json" };
|
|
|
|
// Serve the published registry contract so SSR and browser navigation use the same data.
|
|
createServer((request, response) => {
|
|
response.setHeader("Content-Type", "application/json");
|
|
if (request.url === "/index.json") {
|
|
response.end(JSON.stringify(registry));
|
|
return;
|
|
}
|
|
const plugin = registry.plugins.find((entry) => request.url === `/plugins/${entry.id}.json`);
|
|
response.statusCode = plugin ? 200 : 404;
|
|
response.end(JSON.stringify(plugin ?? { error: "Plugin not found" }));
|
|
}).listen(8188, "127.0.0.1");
|