mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
24 lines
552 B
TypeScript
24 lines
552 B
TypeScript
import { z } from "zod";
|
|
import { Hooks } from "./hooks";
|
|
import { Plugin, PluginConfigManager } from "./plugin";
|
|
import type { Manifest } from "./schema";
|
|
|
|
const myManifest: Manifest = {
|
|
name: "my-plugin",
|
|
description: "A plugin for my app",
|
|
version: "1.0.0",
|
|
};
|
|
|
|
const configManager = new PluginConfigManager(
|
|
z.object({
|
|
apiKey: z.string(),
|
|
}),
|
|
);
|
|
|
|
const myPlugin = new Plugin(myManifest, configManager);
|
|
|
|
myPlugin.registerHandler(Hooks.Response, (req) => {
|
|
console.info("Request received:", req);
|
|
return req;
|
|
});
|