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

feat: code block update on website #915

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion docs_src/src/components/documentation/mdx.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function Col({ children, sticky = false }) {
return (
<div
className={clsx(
'[&>:first-child]:mt-0 [&>:last-child]:mb-0',
'[&>:first-child]:mt-12 [&>:last-child]:mb-0',
sticky && 'xl:sticky xl:top-24'
)}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export const description =
Now that the portal was up and ready, Batman realised that the Joker was using the Gotham Police Dashboard too. So, he wanted to keep a track of the IP address of the client who was accessing his application. He used the following code to do so:


<Row>

<Col>
Batman scaled his application across multiple cores for better performance. He used the following command:
</Col>
<Col sticky>
<Col>

<CodeGroup title="Request" tag="GET" label="/hello_world">

Expand All @@ -27,7 +27,7 @@ Batman scaled his application across multiple cores for better performance. He u

</CodeGroup>
</Col>
</Row>

---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ As Batman found out, Robyn provides an easy way to add an authentication middlew



<Row>

<Col>
</Col>
<Col sticky>
<Col>

<CodeGroup title="Request" tag="GET" label="/hello_world">

Expand All @@ -37,15 +37,15 @@ As Batman found out, Robyn provides an easy way to add an authentication middlew
```
</CodeGroup>
</Col>
</Row>
<Row>



<Col>
To add an authentication middleware, you can use the `configure_authentication` method. This method requires an `AuthenticationHandler` object as an argument. This object specifies how to authenticate a user, and uses a `TokenGetter` object to retrieve the token from the request. Robyn does currently provide a `BearerGetter` class that gets the token from the `Authorization` header, using the `Bearer` scheme. Here is an example of a basic authentication handler:


</Col>
<Col sticky>
<Col>
<CodeGroup title="Request" tag="GET" label="/hello_world">

```python {{ title: 'untyped' }}
Expand Down Expand Up @@ -81,7 +81,7 @@ The authenticate method should return an `Identity` object if the user is authen
</b>


</Row>


---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ After authentication, Batman was worried about the website traffic during the ru
Robyn told Batman that you can pre-compute the response for each route. This will compute the response even before execution. This will improve the response time bypassing the need to access the router.


<Row>

<Col>
</Col>
<Col sticky>
<Col>

<CodeGroup title="Request" tag="GET" label="/hello_world">

Expand All @@ -32,19 +32,19 @@ Robyn told Batman that you can pre-compute the response for each route. This wil
```
</CodeGroup>
</Col>
</Row>


## Muli-core scaling

Robyn told Batman that he can use the `--workers` flag to scale the application to multiple cores. This will create multiple instances of the application and will distribute the load among them. This will improve the performance of the application.


<Row>


<Col>

</Col>
<Col sticky>
<Col>
<CodeGroup title="Request">

```python {{ title: 'untyped' }}
Expand All @@ -64,7 +64,7 @@ The authenticate method should return an `Identity` object if the user is authen
</b>


</Row>


---

Expand Down
4 changes: 2 additions & 2 deletions docs_src/src/pages/documentation/api_reference/cors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Batman was annoyed on getting a CORS error whenever he tried to access the API.

## Scaling the Application

<Row>

<Col>
You can allow CORS for your application by adding the following code:
</Col>
Expand All @@ -33,7 +33,7 @@ You can allow CORS for your application by adding the following code:

</CodeGroup>
</Col>
</Row>


---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ One is for the application level and the other is for the router level.

### Application Level Dependency Injection

<Row>

<Col>
Application level dependency injection is used to inject dependencies into the application. These dependencies are available to all the requests.
</Col>
Expand Down Expand Up @@ -49,12 +49,12 @@ Application level dependency injection is used to inject dependencies into the a
```
</CodeGroup>
</Col>
</Row>



### Router Level Dependency Injection

<Row>

<Col>
Router level dependency injection is used to inject dependencies into the router. These dependencies are available to all the requests of that router.
</Col>
Expand Down Expand Up @@ -89,13 +89,13 @@ Router level dependency injection is used to inject dependencies into the router
```
</CodeGroup>
</Col>
</Row>

<Row>


<Col>
Note: `router_dependencies`, `global_dependencies` are reserved parameters and **must** be named as such. The order of the parameters does not matter among them. However, the `router_dependencies` and `global_dependencies` must only come after the `request` parameter.
</Col>
</Row>


---

Expand Down
6 changes: 3 additions & 3 deletions docs_src/src/pages/documentation/api_reference/exceptions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Batman learned how to create custom error handlers for different exception types in his application. He wrote the following code to handle exceptions and return a custom error response:

<Row>

<Col>
</Col>
<Col sticky>
<Col>

<CodeGroup title="Request" tag="GET" label="/hello_world">

Expand All @@ -22,7 +22,7 @@ Batman learned how to create custom error handlers for different exception types
```
</CodeGroup>
</Col>
</Row>


---

Expand Down
30 changes: 15 additions & 15 deletions docs_src/src/pages/documentation/api_reference/file-uploads.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Batman learned how to handle file uploads using Robyn. He created an endpoint to

## Sending a File without MultiPart Form Data

<Row>

<Col>
Batman scaled his application across multiple cores for better performance. He used the following command:
</Col>
<Col sticky>
<Col>

<CodeGroup title="Request" tag="GET" label="/hello_world">

Expand Down Expand Up @@ -43,16 +43,16 @@ Batman scaled his application across multiple cores for better performance. He u

</CodeGroup>
</Col>
</Row>



## Sending a File with MultiPart Form Data

<Row>

<Col>
Batman scaled his application across multiple cores for better performance. He used the following command:
</Col>
<Col sticky>
<Col>

<CodeGroup title="Request" tag="GET" label="/hello_world">

Expand All @@ -75,7 +75,7 @@ Batman scaled his application across multiple cores for better performance. He u

</CodeGroup>
</Col>
</Row>


---

Expand All @@ -86,11 +86,11 @@ Batman now wanted to allow users to download files from his application. He crea

### Serving Simple HTML Files

<Row>

<Col>
Batman scaled his application across multiple cores for better performance. He used the following command:
</Col>
<Col sticky>
<Col>

<CodeGroup title="Request" tag="GET" label="/hello_world">

Expand Down Expand Up @@ -123,16 +123,16 @@ Batman scaled his application across multiple cores for better performance. He u
```
</CodeGroup>
</Col>
</Row>



### Serving simple HTML strings

<Row>

<Col>
Speaking of HTML files, Batman wanted to serve simple HTML strings. He was suggested to use the following code:
</Col>
<Col sticky>
<Col>

<CodeGroup title="Request" tag="GET" label="/hello_world">

Expand Down Expand Up @@ -167,17 +167,17 @@ Speaking of HTML files, Batman wanted to serve simple HTML strings. He was sugge
```
</CodeGroup>
</Col>
</Row>



### Serving Other Files


<Row>

<Col>
Batman scaled his application across multiple cores for better performance. He used the following command:
</Col>
<Col sticky>
<Col>

<CodeGroup title="Request" tag="GET" label="/hello_world">

Expand Down Expand Up @@ -211,7 +211,7 @@ Batman scaled his application across multiple cores for better performance. He u

</CodeGroup>
</Col>
</Row>



## What's next?
Expand Down
6 changes: 3 additions & 3 deletions docs_src/src/pages/documentation/api_reference/form_data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Batman learned how to handle file uploads using Robyn. Now, he wanted to handle

## Handling Multi Part Form Data

<Row>

<Col>
Batman uploaded some multipart form data and wanted to handle it using the following code:
</Col>
<Col sticky>
<Col>

<CodeGroup title="Request" tag="GET" label="/hello_world">

Expand All @@ -33,7 +33,7 @@ Batman uploaded some multipart form data and wanted to handle it using the follo

</CodeGroup>
</Col>
</Row>



## What's next?
Expand Down
Loading
Loading