mirror of
https://github.com/wassname/ray.git
synced 2026-07-01 11:27:06 +08:00
[Serve] Update front page of serve doc (#11421)
This commit is contained in:
@@ -11,11 +11,12 @@ class Counter:
|
||||
self.count = 0
|
||||
|
||||
def __call__(self, flask_request):
|
||||
self.count += 1
|
||||
return {"current_counter": self.count}
|
||||
|
||||
|
||||
client.create_backend("counter", Counter)
|
||||
client.create_endpoint("counter", backend="counter", route="/counter")
|
||||
|
||||
requests.get("http://127.0.0.1:8000/counter").json()
|
||||
# > {"current_counter": 0}
|
||||
print(requests.get("http://127.0.0.1:8000/counter").json())
|
||||
# > {"current_counter": 1}
|
||||
|
||||
@@ -13,5 +13,5 @@ def echo(flask_request):
|
||||
client.create_backend("hello", echo)
|
||||
client.create_endpoint("hello", backend="hello", route="/hello")
|
||||
|
||||
requests.get("http://127.0.0.1:8000/hello").text
|
||||
# > "hello serve!"
|
||||
print(requests.get("http://127.0.0.1:8000/hello").text)
|
||||
# > hello serve!
|
||||
|
||||
Reference in New Issue
Block a user