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

Apply Python highlight on api.md #126

Merged
merged 1 commit into from Dec 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 27 additions & 25 deletions docs/api.md
Expand Up @@ -51,43 +51,45 @@ The request object contains the `body` in PUT/POST/PATCH. The `header`s are avai
Robyn supports every HTTP request method. The examples of some of them are below:
### GET Request

```python3
@app.get("/")
async def h(request):
return "Hello World"
```
```python3
@app.get("/")
async def h(request):
return "Hello World"
```

### POST Request

```python3
@app.post("/post")
async def postreq(request):
return bytearray(request["body"]).decode("utf-8")
```
```python3
@app.post("/post")
async def postreq(request):
return bytearray(request["body"]).decode("utf-8")
```

### PUT Request

```python3
@app.put("/put")
async def postreq(request):
return bytearray(request["body"]).decode("utf-8")
```
```python3
@app.put("/put")
async def postreq(request):
return bytearray(request["body"]).decode("utf-8")
```


### PATCH Request
```python3
@app.patch("/patch")
async def postreq(request):
return bytearray(request["body"]).decode("utf-8")
```

```python3
@app.patch("/patch")
async def postreq(request):
return bytearray(request["body"]).decode("utf-8")
```


### DELETE Request
```python3
@app.delete("/delete")
async def postreq(request):
return bytearray(request["body"]).decode("utf-8")
```

```python3
@app.delete("/delete")
async def postreq(request):
return bytearray(request["body"]).decode("utf-8")
```


### Having Dynamic Routes
Expand Down