core: make API a service

This commit is contained in:
undefined committed 2024-05-25 02:14:07 +08:00
1 parent f48f8fe5f7
commit d4116c502e
8 files changed
+388 -357

No files matched your search

+5 -2
View File
@@ -38,11 +38,14 @@ export async function apply(ctx: Context) {
await modelSystem.runConfig();
const storage = require('../service/storage');
await storage.loadStorageService();
await require('../service/worker').apply(ctx);
await require('../service/server').apply(ctx);
// Make sure everything is ready and then start main entry
if (argv.options.watch) ctx.plugin(require('../service/watcher').default, {});
await ctx.root.start();
await ctx.lifecycle.flush();
await require('../service/worker').apply(ctx);
await require('../service/server').apply(ctx);
await require('../service/api').apply(ctx);
await ctx.lifecycle.flush();
require('../lib/index');
await lib(pending, fail, ctx);
await ctx.lifecycle.flush();