Jobs
Execute a specific job (task) when your application starts.
# Execute the built-in Deno task
deno task create:module -t job -n createDefaultUser --template blank.tsimport { Application } from "oak";
// If the sequence of the execution doesn't matter, you can also write your code here in this scope...
// But it is recommended to write the code in the following default function if the sequence does matter:
export default async (app: Application) => {
// Write the logic to execute on app start (before server starts listening)...
return async () => {
// This code executes when the app receives "SIGINT" | "SIGTERM" | "SIGBREAK" signal.
// Your optional cleanup code here...
};
};
Last updated