You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/src/pages/documentation/app.md
+28-5Lines changed: 28 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,34 @@ by parameters declaration via TypeScript types and are automatically serialized
23
23
24
24
[Deepkit Framework](./framework.md) with `@deepkit/framework` extends this further with an application server for HTTP/RPC, a debugger/profiler, and much more.
25
25
26
+
Example:
27
+
28
+
```typescript
29
+
import { App, Flag } from'@deepkit/app';
30
+
import { Database } from'./database';
31
+
32
+
const app =newApp({
33
+
providers: [Database]
34
+
});
35
+
36
+
asyncfunction testCommand(
37
+
name:string, // CLI argument
38
+
age:number&Flag, // CLI flag
39
+
database:Database, // Dependency Injection
40
+
) {
41
+
console.log(`Hello ${name}!`);
42
+
const users =awaitdatabase.query<User>().find();
43
+
}
44
+
45
+
app.command('test', testCommand);
46
+
47
+
voidapp.run();
48
+
```
49
+
50
+
```sh
51
+
ts-node app.ts test John --age 42
52
+
```
53
+
26
54
## Installation Easy
27
55
28
56
The easiest way to get started is to use NPM init to create a new Deepkit project.
@@ -126,11 +154,6 @@ VERSION
126
154
USAGE
127
155
$ ts-node app.ts [COMMAND]
128
156
129
-
TOPICS
130
-
debug
131
-
migration Executes pending migration files. Use migration:pending to see which are pending.
0 commit comments