[INIT] Initial Project Structure
This commit is contained in:
commit
0fc5f05b6a
105 changed files with 10448 additions and 0 deletions
32
lib/Cairo.ts
Normal file
32
lib/Cairo.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Import Core Modules
|
||||
import { INFO, OK, logInfo } from "@dunemask/vix/logging";
|
||||
import { Vixpress } from "@dunemask/vix";
|
||||
import { MappedRoute, routePreviews } from "@dunemask/vix/express";
|
||||
import figlet from "figlet";
|
||||
import AppRouter from "./vix/AppRouter.js";
|
||||
import PostgresService from "./database/PostgresService.js";
|
||||
import AppInitService from "./services/app-init.service.js";
|
||||
|
||||
export default class Cairo extends Vixpress {
|
||||
static PostgresService: string = "pg";
|
||||
static AppInitService: string = "app-init";
|
||||
constructor(port?: number) {
|
||||
super("Cairo", port ?? Number(process.env.CAIRO_DEV_PORT ?? 52000));
|
||||
this.setService(Cairo.PostgresService, PostgresService);
|
||||
this.setService(Cairo.AppInitService, AppInitService);
|
||||
this.setRouter(AppRouter);
|
||||
}
|
||||
|
||||
protected async preconfigure(): Promise<void> {
|
||||
logInfo(figlet.textSync(this.title, "Cosmike"));
|
||||
}
|
||||
|
||||
protected async onStart() {
|
||||
const previews = routePreviews(this.app, (r: MappedRoute, methodDisplay: string) => {
|
||||
const authSection = r.routeMetadata?.authType === "user" ? "🔒" : " ";
|
||||
return `${methodDisplay} ${authSection} ${r.path}`;
|
||||
});
|
||||
for (const p of previews) INFO("ROUTE", p);
|
||||
OK("SERVER", `${this.title} server running on ${this.port} 🚀`);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue