Skip to content

Commit

Permalink
feat(docs): add new methods of helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
jlenon7 committed Feb 10, 2024
1 parent 18a4e22 commit 1bb5d62
Show file tree
Hide file tree
Showing 5 changed files with 748 additions and 779 deletions.
3 changes: 2 additions & 1 deletion docs/digging-deeper/collections.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ As you can see in the example above, creating a collection is as simples as:
const collection = new Collection([1, 2, 3])
```

Simplifying even more: Athenna has extended the `Array` class to simply convert an array to a collection using the `toAthennaCollection()` method:
Simplifying even more: Athenna has extended the `Array` class to simply convert
an array to a collection using the `toAthennaCollection()` method:

```typescript
const numbers = [1, 2, 3]
Expand Down
26 changes: 26 additions & 0 deletions docs/getting-started/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,32 @@ import { Config } from '@athenna/config'
await Config.loadAll(Path.stubs('config'))
```

### Get configuration with `@Value()` decorator

Instead of using the `Config.get()` method to get a configuration
value, you can use the `@Value()` annotation in your classes to
automatically add it value to a class property:

```typescript
import { Value } from '@athenna/config'

export class UserService {
@Value('api.users') 👈
public api: string
}
```

:::tip

Just like `Config.get()` method, you can set a default value
when using the `@Value()` annotation:

```typescript
@Value('api.users', 'http://localhost:3000/users') 👈
```

:::

### Define my own configuration path

If you are using the [slim](https://athenna.io/docs/getting-started/installation#project-structure)
Expand Down
Loading

0 comments on commit 1bb5d62

Please sign in to comment.