Skip to content

Commit

Permalink
Apply Python highlight on api.md (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex committed Dec 11, 2021
1 parent a591041 commit 35af995
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions docs/api.md
Original file line number Diff line number Diff line change
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

0 comments on commit 35af995

Please sign in to comment.