Skip to content

Commit e098f57

Browse files
committed
fix(website): docs
1 parent f1ef954 commit e098f57

File tree

1 file changed

+28
-5
lines changed
  • website/src/pages/documentation

1 file changed

+28
-5
lines changed

website/src/pages/documentation/app.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,34 @@ by parameters declaration via TypeScript types and are automatically serialized
2323

2424
[Deepkit Framework](./framework.md) with `@deepkit/framework` extends this further with an application server for HTTP/RPC, a debugger/profiler, and much more.
2525

26+
Example:
27+
28+
```typescript
29+
import { App, Flag } from '@deepkit/app';
30+
import { Database } from './database';
31+
32+
const app = new App({
33+
providers: [Database]
34+
});
35+
36+
async function 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 = await database.query<User>().find();
43+
}
44+
45+
app.command('test', testCommand);
46+
47+
void app.run();
48+
```
49+
50+
```sh
51+
ts-node app.ts test John --age 42
52+
```
53+
2654
## Installation Easy
2755

2856
The easiest way to get started is to use NPM init to create a new Deepkit project.
@@ -126,11 +154,6 @@ VERSION
126154
USAGE
127155
$ ts-node app.ts [COMMAND]
128156

129-
TOPICS
130-
debug
131-
migration Executes pending migration files. Use migration:pending to see which are pending.
132-
server Starts the HTTP server
133-
134157
COMMANDS
135158
test
136159
```

0 commit comments

Comments
 (0)