silverbullet/lib/plugos/test_func.test.ts

23 lines
505 B
TypeScript
Raw Normal View History

import * as YAML from "js-yaml";
import {
EndpointRequest,
EndpointResponse,
} from "../../server/hooks/endpoint.ts";
2024-01-14 20:38:39 +08:00
export async function hello() {
const numbers = await syscall("addNumbers", 1, 2);
return {
yamlMessage: YAML.dump({ hello: "world" }),
2024-01-14 20:38:39 +08:00
addedNumbers: numbers,
};
}
2023-08-12 02:37:13 +08:00
export function endpoint(req: EndpointRequest): EndpointResponse {
console.log("Req", req);
return {
status: 200,
body: [1, 2, 3],
headers: { "Content-type": "application/json" },
};
}