Giter Site home page Giter Site logo

kritik-j / api-reference Goto Github PK

View Code? Open in Web Editor NEW

This project forked from triggerdotdev/api-reference

0.0 0.0 0.0 349 KB

This repository provides job code samples that use either SDKs or the fetch method to interact with external APIs and Trigger.dev.

Home Page: https://trigger.dev

TypeScript 100.00%

api-reference's Introduction

Trigger.dev logo

Trigger.dev API references

This repository provides job code samples that use either SDKs or the fetch method to interact with external APIs and Trigger.dev. Refer to these examples if you're working with APIs that don't have an official Trigger.dev integration yet.

For a full list of our official supported integrations please refer to our integration docs:

About Trigger.dev

Trigger.dev is a framework for creating long-running Jobs directly in your Next.js app with API integrations, webhooks, scheduling and delays. You can reliably run Jobs that wouldn’t normally work in serverless environments (like Vercel) because of timeouts.

Jobs in this repo:

These jobs can be run locally using the @trigger.dev/cli and @trigger.dev/express packages.

Setup: how to use this repo

You will need to create a .env file. You can duplicate the contents of .env.example file and set your local (Dev 'server') TRIGGER_API_KEY value. You can find your API key in your project's integrations page in the app. Add other API keys as needed.

Install packages

First, install the packages:

npm i

Running a job

Each file in src is either a Job or a separate set of jobs that can be run separately. For example, the src/cronScheduledBasic.ts file can be run with:

npm run github

This will open up a local server using express on port 8080. Then in a separate terminal window you can run the @trigger.dev/cli dev command:

npm run dev:trigger

Contributors guide

You can add a new file to src with it's own TriggerClient and set of jobs (e.g. src/events.ts)

import { TriggerClient, eventTrigger } from "@trigger.dev/sdk";
import { createExpressServer } from "@trigger.dev/express";
import { z } from "zod";

export const client = new TriggerClient({ id: "api-reference" });

client.defineJob({
  id: "example-job",
  name: "Example Job",
  version: "1.0.0",
  trigger: eventTrigger({
    name: "example.one",
  }),
  run: async (payload, io, ctx) => {},
});

createExpressServer(client);

Then add a new script in package.json:

{
  "scripts": {
    "events": "nodemon --watch src/events.ts -r tsconfig-paths/register -r dotenv/config src/events.ts"
  }
}

api-reference's People

Contributors

biplobsd avatar d-k-p avatar froostycodes avatar gjohnsx avatar hmacr avatar kartik1397 avatar kritik-j avatar matt-aitken avatar nabinbhatt avatar nicktrn avatar shelar1423 avatar sp6370 avatar xementor avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.