Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements #81

Merged
merged 4 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/cli-application/running.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ yourCliCommand --help

When running your CLI without any option and command, the display
name will be rendered in the terminal using
[`chalk-rainbow`](https://www.npmjs.com/package/chalk-rainbow)
and [`figlet`](https://www.npmjs.com/package/figlet).
[chalk-rainbow](https://www.npmjs.com/package/chalk-rainbow)
and [figlet](https://www.npmjs.com/package/figlet).

By default Artisan always display the `Artisan` name, but you can
change it for your own display name by setting the `displayName`
Expand Down
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
16 changes: 16 additions & 0 deletions docs/rest-api-application/security-with-helmet.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Security with Helmet
sidebar_position: 9
description: See how to improve the security of your REST API with Helmet in Athenna.
tags:
- REST API Application
- Security with Helmet
---

# Security with Helmet

See how to improve the security of your REST API with Helmet in Athenna.

## Introduction

Coming soon
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
Loading
Loading