How to manually setup Trigger.dev in your Astro project
tr_dev_
).
.env
file at the root of your project and include your Trigger API key and URL like this:
ENTER_YOUR_DEVELOPMENT_API_KEY_HERE
with the actual API key obtained from the previous step.
<root>/trigger.ts
or <root>/src/trigger.ts
, depending on if your project uses a src
directory, where <root>
represents the root directory of your project.
Next, add the following code to the file which creates and exports a new TriggerClient
:
jobs
alongside your pages
directoryjobs
folder, add two files named example.ts
and index.ts
.trigger.ts
within the pages/api/
directory.trigger.ts
:package.json
package.json
file, add the following configuration under the root object:
package.json
file might look something like this:
TriggerClient
.
jobs
folder and exporting them in index
file.
For example, in index.ts
, you can export other job files like this:
--hostname <host>
. Example, in case your Astro app is running on 0.0.0.0: --hostname 0.0.0.0
.