1
0
silverbullet/plugos/test_func.test.ts
2024-01-14 13:38:39 +01:00

20 lines
528 B
TypeScript

import * as YAML from "https://deno.land/std@0.184.0/yaml/mod.ts";
import { EndpointRequest, EndpointResponse } from "./hooks/endpoint.ts";
export async function hello() {
const numbers = await syscall("addNumbers", 1, 2);
return {
yamlMessage: YAML.stringify({ hello: "world" }),
addedNumbers: numbers,
};
}
export function endpoint(req: EndpointRequest): EndpointResponse {
console.log("Req", req);
return {
status: 200,
body: [1, 2, 3],
headers: { "Content-type": "application/json" },
};
}