@aponiajs/common 0.0.0 → 0.2.1
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/README.md +40 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,48 @@
|
|
|
1
1
|
# @aponiajs/common
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@aponiajs/common)
|
|
4
|
+
|
|
3
5
|
Platform-neutral decorators and public contracts for Aponia modules,
|
|
4
6
|
controllers, routes, and dependency injection.
|
|
5
7
|
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
bun add @aponiajs/common
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Public surface
|
|
15
|
+
|
|
6
16
|
The public application authoring API includes `@Module()`, `@Controller()`,
|
|
7
17
|
HTTP method decorators, `@Injectable()`, and `@Inject()`. This package does not
|
|
8
18
|
depend on Elysia, Bun runtime APIs, or another Aponia package.
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { Controller, Get, Injectable, Module } from "@aponiajs/common";
|
|
22
|
+
|
|
23
|
+
@Injectable()
|
|
24
|
+
class GreetingService {
|
|
25
|
+
greet(): string {
|
|
26
|
+
return "Hello!";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Controller("greetings")
|
|
31
|
+
class GreetingController {
|
|
32
|
+
constructor(private readonly greetings: GreetingService) {}
|
|
33
|
+
|
|
34
|
+
@Get()
|
|
35
|
+
getGreeting(): string {
|
|
36
|
+
return this.greetings.greet();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@Module({
|
|
41
|
+
controllers: [GreetingController],
|
|
42
|
+
providers: [GreetingService],
|
|
43
|
+
})
|
|
44
|
+
export class GreetingModule {}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
[npm package](https://www.npmjs.com/package/@aponiajs/common) ·
|
|
48
|
+
[complete package catalog](../../docs/packages.md)
|
package/package.json
CHANGED