create-colonel 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-colonel",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src",
@@ -14,4 +14,4 @@ export class AppController extends Controller {
14
14
  },
15
15
  ]
16
16
  }
17
- }
17
+ }
@@ -0,0 +1,7 @@
1
+ export class AppInfoService {
2
+ constructor(private appName: string) {}
3
+
4
+ welcomeTitle(): string {
5
+ return `Welcome to ${this.appName}`;
6
+ }
7
+ }
@@ -5,10 +5,15 @@ import { extensions } from "../config/acceptedStaticContentTypes";
5
5
  import { isStaticPath, contentTypeFor, toPublicFilePath } from "@coloneldev/framework";
6
6
  import { staticPaths } from "../config/staticPaths";
7
7
  import path, { extname } from "path";
8
+ import { Container } from "@coloneldev/framework";
9
+ import { AppInfoService } from "../app/Services/AppInfoService.ts";
8
10
 
9
11
  const viewsRoot = path.resolve(import.meta.dir, "..", "..", "resources", "views");
10
12
  const publicRoot = path.resolve(import.meta.dir, "..", "..", "public");
11
13
  const controllerRoot = path.resolve(import.meta.dir, "..", "app", "Http", "Controllers");
14
+ const container = new Container();
15
+
16
+ container.singleton(AppInfoService, () => new AppInfoService(process.env.appName ?? "Colonel"));
12
17
 
13
18
  export const server = () => {
14
19
  const Colonel = new Kernel(webRouter, [], {
@@ -24,7 +29,7 @@ export const server = () => {
24
29
 
25
30
  return controller;
26
31
  }
27
- });
32
+ }, container);
28
33
  const PORT = Number(process.env.PORT) || 5000;
29
34
 
30
35
  console.log(`Server running at http://localhost:${PORT}/`);