-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
31 lines (27 loc) · 913 Bytes
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { initControllers } from "./controllers/mod.ts";
import { initServices } from "./services/mod.ts";
import { initRepositories } from "./repositories/mod.ts";
import { initManagers } from "./managers/mod.ts";
import { initJobs } from "./jobs/mod.ts";
import { ConsoleLogger, Grove, JobMode, WebMode } from "../src/mod.ts";
import type { Context, JobContext, State } from "./context.ts";
async function initContext(): Promise<Context> {
const services = await initServices();
const repositories = await initRepositories(services);
const managers = await initManagers(repositories);
return {
log: new ConsoleLogger(),
services,
repositories,
managers,
};
}
const grove = new Grove({
initContext,
modes: [
new WebMode<Context, State>({ initControllers }),
new JobMode<JobContext>({ initJobs }),
],
});
await grove.start(Deno.args);
// deno run -A example/main.ts web