6769d6b439
commit c028db229cece2bf7d7acf04e7b1c08fea61798c Author: Matt Aitken <matt@mattaitken.com> Date: Fri Oct 13 16:04:54 2023 +0100 Some fixes for getting the endpoint id commit e31b7ac5f2d451f70e3d42a3fb3e5f718d93485b Author: Matt Aitken <matt@mattaitken.com> Date: Fri Oct 13 15:39:18 2023 +0100 Added a link in the instructions if Node isn’t detected commit 1a59cced775fbeac3e5b94e0c151b490c838d8f8 Author: Matt Aitken <matt@mattaitken.com> Date: Fri Oct 13 15:39:05 2023 +0100 Fixed some conflict issues commit 77263ed26bcf7025071ac0faf15fb867fff245d0 Author: Matt Aitken <matt@mattaitken.com> Date: Fri Oct 13 15:38:56 2023 +0100 Added a changeset commit 1a7df3f37f0c65d68cb9a9fe7ac50328bbb4d879 Author: GuyBorderless <100129659+guy-borderless@users.noreply.github.com> Date: Fri Oct 13 17:31:01 2023 +0300 feat: enable deno (#531) * adding deno reference project and JSRuntime file * accessing runtime specific functions through JsRuntime * adding support for both deno.json and deno.jsonc * no automatic setup for deno projects currently --------- Co-authored-by: Guy Kedem <guy@propertiz.net> Co-authored-by: Matt Aitken <matt@mattaitken.com>
42 lines
841 B
TypeScript
42 lines
841 B
TypeScript
import { TriggerClient } from "npm:@trigger.dev/sdk";
|
|
import { eventTrigger } from "npm:@trigger.dev/sdk";
|
|
|
|
export const triggerClient = new TriggerClient({
|
|
id: "borderless",
|
|
apiKey: "...",
|
|
});
|
|
|
|
// your first job
|
|
triggerClient.defineJob({
|
|
id: "example-job",
|
|
name: "Example Job",
|
|
version: "0.0.1",
|
|
trigger: eventTrigger({
|
|
name: "example.event",
|
|
}),
|
|
run: async (payload, io, ctx) => {
|
|
await io.logger.info("Hello world!", { payload });
|
|
|
|
return {
|
|
message: "Hello world!",
|
|
};
|
|
},
|
|
});
|
|
|
|
Deno.serve(async (req) => {
|
|
const response = await triggerClient.handleRequest(req);
|
|
if (!response) {
|
|
return Response.json(
|
|
{ error: "Not found" },
|
|
{
|
|
status: 404,
|
|
}
|
|
);
|
|
}
|
|
|
|
return Response.json(response.body, {
|
|
status: response.status,
|
|
headers: response.headers,
|
|
});
|
|
});
|