Skip to content

Commit

Permalink
chore(docs): add titles in code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
jlenon7 committed Aug 15, 2023
1 parent 7612169 commit 133ef16
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions docs/digging-deeper/collections.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ check out the following code. We'll create a new instance of `Collection` using
get all elements where the id is **1, 2 or 3**, order everything in ascending mode by **name** and then get only the value of
the property `name` of each one of the elements:

```javascript
```typescript
const users = [
{ id: 1, name: 'Marcelo Oliveira'},
{ id: 2, name: 'Vinicius Campelo' },
Expand Down Expand Up @@ -49,13 +49,13 @@ array. In general, collections are immutable, meaning every Collection method re

As you can see in the example above, creating a collection is as simples as:

```javascript
```typescript
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 `toCollection` method:

```javascript
```typescript
const numbers = [1, 2, 3]

const collection = numbers.toCollection()
Expand All @@ -73,7 +73,7 @@ Collections are extendable, which allows you to add additional methods to the Co
other methods via `this`, just as if it were a real method of the collection class. For example, the following code adds a `toUpper`
method to the `Collection` class:

```javascript
```typescript
import { Collection } from '@athenna/common'

Collection.macro('toUpper', function () {
Expand All @@ -96,7 +96,7 @@ a [service provider](/docs/architecture-concepts/providers).

If necessary, you may define macros that accept additional arguments:

```javascript
```typescript
Collection.macro('remove', function (key) {
return this.map(item => {
if (item[key]) {
Expand Down
2 changes: 1 addition & 1 deletion docs/digging-deeper/repl.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ When running this command, Athenna will use the

To import modules inside REPL you need to use dynamic imports:

```javascript
```typescript
{ Log } = await import('@athenna/logger') // Destructuring import
helpers = await import('#app/helpers/index') // Default import
```
Expand Down
8 changes: 4 additions & 4 deletions docs/rest-api-application/rate-limiting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ plugin inside `HttpKernel`. All the configurations that
`@fastify/rate-limit` supports can be set inside `Path.config('http.ts')`
file in the `rateLimit` object:

```typescript
```typescript title="Path.config('http.ts')"
export default {
rateLimit: {
global: true,
Expand All @@ -46,7 +46,7 @@ for specific routes. You can also disable the `global`
option of your `rateLimit` configuration in `Path.config('http.ts')`
and set different rules in your routes:

```typescript
```typescript title="Path.route('http.ts')"
Route
.get('/hello', 'WelcomeController.show')
.rateLimit({ max: 1, timeWindow: '1 minute' }) 👈
Expand All @@ -58,7 +58,7 @@ You can also use the `rateLimit()` method in route groups.
This will set the same configuration for all routes inside
the group:

```typescript
```typescript title="Path.route('http.ts')"
Route.group(() => {
Route.get('/hello', 'WelcomeController.show')
}).rateLimit({ max: 1, timeWindow: '1 minute' }) 👈
Expand All @@ -76,7 +76,7 @@ to create "defaults" configurations for all routes.

Same behavior as route groups, but for resources:

```typescript
```typescript title="Path.route('http.ts')"
// Set the same configurations for all routes of resource
Route.resource('/tests', 'WelcomeController').rateLimit({...})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: Swagger
title: Swagger Documentation
sidebar_position: 6
description: See how to create the Swagger documentation for Athenna REST API application.
tags:
- REST API Application
- Swagger
- Swagger Documentation
---

# Swagger
Expand All @@ -27,7 +27,7 @@ supports can be set inside `Path.config('http.ts')` file in the `swagger.configu
object. And all the configurations that `@fastify/swagger-ui`
supports can be set inside `Path.config('http.ts')` file in the `swagger.ui` object:

```typescript
```typescript title="Path.config('http.ts')"
export default {
swagger: {
ui: {
Expand Down Expand Up @@ -60,7 +60,7 @@ export default {
You can set your Swagger configurations using
the `Route` facade in `routes/http.js` file:

```typescript
```typescript title="Path.route('http.ts')"
Route.get('/hello', 'WelcomeController.show')
.summary('Hello route')
.tags('hello', 'world')
Expand All @@ -80,7 +80,7 @@ Route.get('/hello', 'WelcomeController.show')
You can also use the `swagger()` method and use
the same configurations of `@fastify/swagger` plugin:

```typescript
```typescript title="Path.route('http.ts')"
Route.get('/hello', 'WelcomeController.show').swagger({
summary: 'Hello route',
tags: ['hello', 'world'],
Expand Down Expand Up @@ -111,7 +111,7 @@ You can also use all the swagger methods in route groups.
This will set the same configuration for all routes inside
the group:

```javascript
```typescript title="Path.route('http.ts')"
Route.group(() => {
Route.get('/hello', 'WelcomeController.show').summary('Hello route')
}).swagger({...})
Expand All @@ -129,7 +129,7 @@ configurations for all routes such as `security`.

Same behavior as route groups, but for resources:

```javascript
```typescript title="Path.route('http.ts')"
// Set the same configurations for all routes of resource
Route.resource('/tests', 'WelcomeController').swagger({...})

Expand Down
6 changes: 3 additions & 3 deletions docs/rest-api-application/tracing-requests.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ plugin inside `HttpKernel`. All the configurations
that `cls-rtracer` supports can be set inside
`Path.config('http.ts')` file in the `rTracer` object:

```typescript
```typescript title="Path.config('http.ts')"
export default {
trace: true,
rTracer: {
Expand All @@ -43,7 +43,7 @@ plugin will be enabled and a UUID will be generated
for each request. This UUID will be available in
`request.id` property of your routes:

```typescript
```typescript title="Path.routes('http.ts')"
import { Log } from '@athenna/logger'
import { Route } from '@athenna/http'

Expand All @@ -58,7 +58,7 @@ Route.get('/', ({ request }) => {

Athenna request logger enabled by `http.logger`
configuration will automatically log the request
ID for you.
ID for you depending on the formatter your are using.

:::

Expand Down

0 comments on commit 133ef16

Please sign in to comment.