Ninja Extra Path Parameters
The parameters of the route path are declared as Python formatted strings. For example:
from ninja_extra import api_controller, route
from ninja import constants
@api_controller('', tags=['My Operations'], auth=constants.NOT_SET, permissions=[])
class MyAPIController:
@route.get('/users/{user_id}')
def get_user_by_id(self, user_id: int):
return {'user_id': user_id}
The value of the path parameter user_id will be passed to your function as the parameter user_id.
Info
Read more
Comments
本文总阅读量次
