@@ -2,7 +2,9 @@ import type { AppConfig, AuthService, Feature, JobHandler, JobQueue, ServerConte
|
||||
import { createApp, createJobQueue, loadConfig } from "@stc/core";
|
||||
import { createCourseRepository } from "@stc/course-format";
|
||||
import { connect, migrate } from "@stc/db";
|
||||
import { importFeature } from "@stc/feature-import";
|
||||
import { learnerFeature } from "@stc/feature-learner";
|
||||
import { resolve } from "node:path";
|
||||
import indexHtml from "../../web/index.html";
|
||||
|
||||
// Used until a feature supplies an `auth` service (the learner package does).
|
||||
@@ -49,8 +51,12 @@ export async function startServer(
|
||||
|
||||
if (import.meta.main) {
|
||||
const config = loadConfig();
|
||||
// Contract request (import.md): core config should include <dataDir>/courses itself.
|
||||
const generated = resolve(config.dataDir, "courses");
|
||||
if (!config.courseDirs.some((c) => resolve(c) === generated)) config.courseDirs.push(generated);
|
||||
const { server } = await startServer(config, [
|
||||
learnerFeature,
|
||||
(ctx) => importFeature(ctx),
|
||||
]);
|
||||
console.log(`STCourses listening on ${server.url}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user