Skip to content

Commit

Permalink
docs: improve visuals
Browse files Browse the repository at this point in the history
  • Loading branch information
sansyrox committed Aug 29, 2022
1 parent 378a440 commit ae8a82e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 28 deletions.
2 changes: 0 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
Robyn is an async Python backend server with a runtime written in Rust, btw.


Check out the talk at **PyCon Sweden 2021** about [Robyn: An async python web framework with a Rust runtime](https://www.youtube.com/watch?v=DK9teAs72Do)

## 📦 Installation

You can simply use Pip for installation.
Expand Down
1 change: 1 addition & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
- [Community Resources](community-resources.md)
- [Future Roadmap](roadmap.md)
- [Plugins](plugins.md)
- [Hosting](hosting.md)
- [Sponsors](sponsors.md)

30 changes: 16 additions & 14 deletions docs/features.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
## Features


### Synchronous Requests
## Synchronous Requests
Robyn supports both sync methods and async methods for fetching requests. Every method gets a request object from the routing decorator.

```python3

@app.get("/")
def h():
return "Hello, world"
```

### Async Requests
## Async Requests

```python3
@app.get("/")
Expand All @@ -18,12 +20,12 @@ async def h():
```


### All kinds of HTTP Requests
Robyn supports both sync methods and async methods for fetching requests. Every method gets a request object from the routing decorator.
## All kinds of HTTP Requests

The request object contains the `body` in PUT/POST/PATCH. The `header`s are available in every request object.

Robyn supports every HTTP request method. The examples of some of them are below:

#### GET Request

```python3
Expand Down Expand Up @@ -77,7 +79,7 @@ app.add_directory(
)
```

### Dynamic Routes
## Dynamic Routes
You can add params in the routes and access them from the request object.

```python3
Expand All @@ -87,7 +89,7 @@ async def json(request):
return jsonify({"hello": "world"})
```

### Returning a JSON Response
## Returning a JSON Response
You can also serve JSON responses when serving HTTP request using the following way.

```python3
Expand All @@ -99,7 +101,7 @@ async def json(request):
return jsonify({"hello": "world"})
```

### Global Headers
## Global Headers
You can also add global headers for every request.

```python3
Expand All @@ -108,7 +110,7 @@ app.add_header("server", "robyn")
```


### Query Params
## Query Params

You can access query params from every HTTP method.

Expand All @@ -124,7 +126,7 @@ async def query_get(request):
```


### Events
## Events

You can add startup and shutdown events in robyn. These events will execute before the requests have started serving and after the serving has been completed.

Expand All @@ -140,7 +142,7 @@ def shutdown_handler():
print("Shutting down")
```

### WebSockets
## WebSockets

You can now serve websockets using Robyn.

Expand Down Expand Up @@ -189,7 +191,7 @@ The three methods:
To see a complete service in action, you can go to the folder [../integration_tests/base_routes.py](../integration_tests/base_routes.py)


### Usage
#### Web Socket Usage

```python3
@websocket.on("message")
Expand All @@ -216,7 +218,7 @@ async def message():

```

### Middlewares
## Middlewares

You can use both sync and async functions for middlewares!

Expand All @@ -231,15 +233,15 @@ def hello_after_request(request):
print(request)
```

### MultiCore Scaling
## MultiCore Scaling

To run Robyn across multiple cores, you can use the following command:

`python3 app.py --workers=N --processes=N`



### Const Requests
## Const Requests

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.

Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ app.start(port=5000, url="0.0.0.0") # url is optional, defaults to 127.0.0.1

Let us try to decipher the usage line by line.

> from robyn import Robyn
> `from robyn import Robyn`
This statement just imports the Robyn structure from the robyn package.

> app = Robyn(__file__)
> `app = Robyn(__file__)`
Here, we are creating the app object. We require the `__file__` object to mount the directory for hot reloading.

Expand Down
5 changes: 5 additions & 0 deletions docs/hosting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Hosting

The process of hosting a Robyn app on various cloud providers.

Coming Soon....
20 changes: 11 additions & 9 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
## Future Roadmap
- #### More Performance Optimizations
- Add graphql integration
- And more...


### Planned Integrations
- #### OpenAPI Integration
- #### Pydantic Integration
- #### GraphQL(Strawberry) Integration

- Add performance optimizations
- OpenAPI Integration
- Pydantic Integration
- Implement Auto Const Requests
- Add ORM support, especially Prisma integration
- Improve Plugin Ecosystem
- Better Documentation
- Improve the Websockets
- Template Support
- Graphql integration with Strawberry
- Invest more time in the community around Robyn.
1 change: 0 additions & 1 deletion docs/usage.md

This file was deleted.

0 comments on commit ae8a82e

Please sign in to comment.