Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Added require_http_methods for example
  • Loading branch information
vitaliypopel authored Oct 6, 2024
1 parent 539fd9a commit 034e631
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ router = Router('/app', 'app', auto_trailing_slash=True)
# or = Router(prefix='/app', app_name='app', auto_trailing_slash=True)


@router.route('/hello-world')
@router.route('/hello-world', methods=['GET'])
def hello_world(request: HttpRequest) -> HttpResponse:
return HttpResponse('Hello World!')
```
Expand All @@ -65,8 +65,10 @@ urlpatterns = [
~/project/app/views.py:
```python
from django.http import HttpRequest, HttpResponse
from django.views.decorators.http import require_http_methods


@require_http_methods(['GET'])
def hello_world(request: HttpRequest) -> HttpResponse:
return HttpResponse('Hello World!')
```
Expand Down

0 comments on commit 034e631

Please sign in to comment.