# Ray Serve : Example not working

**URL:** <https://discuss.ray.io/t/ray-serve-example-not-working/4502>\
**Category:** Ray Serve\
**Created:** [December 21, 2021, 10:01pm UTC](https://discuss.ray.io/t/ray-serve-example-not-working/4502 "2021-12-21T22:01:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lihost](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/lihost/32/1896_2.png) [@lihost](https://discuss.ray.io/u/lihost)\
**Post date:** [December 21, 2021, 10:01pm UTC](https://discuss.ray.io/t/ray-serve-example-not-working/4502/1 "2021-12-21T22:01:27Z")

</div>

Example mentioned at [Calling Deployments via HTTP and Python — Ray v1.9.0](https://docs.ray.io/en/latest/serve/http-servehandle.html#fastapi-http-deployments), does not seems to be working for me.

Here is how I am running.

```auto
#main.py
import ray

from fastapi import FastAPI
from ray import serve

app = FastAPI()
ray.init(address="auto", namespace="summarizer")
serve.start(detached=True)

@app.get("/")
def f():
    return "Hello from the root!"

@serve.deployment(route_prefix="/api1")
@serve.ingress(app)
class FastAPIWrapper1:
    @app.get("/subpath")
    def method(self):
        return "Hello 1!"

@serve.deployment(route_prefix="/api2")
@serve.ingress(app)
class FastAPIWrapper2:
    @app.get("/subpath")
    def method(self):
        return "Hello 2!"

FastAPIWrapper1.deploy()
FastAPIWrapper2.deploy()

```

I am starting ray with `ray start --head`

Here is the output from post deployment

```auto
❯ python main.py
2021-12-21 13:54:55,429	INFO worker.py:842 -- Connecting to existing Ray cluster at address: 127.0.0.1:6379
(ServeController pid=94776) 2021-12-21 13:54:56,285	INFO checkpoint_path.py:16 -- Using RayInternalKVStore for controller checkpoint and recovery.
(ServeController pid=94776) 2021-12-21 13:54:56,288	INFO http_state.py:98 -- Starting HTTP proxy with name 'SERVE_CONTROLLER_ACTOR:SERVE_PROXY_ACTOR-node:127.0.0.1-0' on node 'node:127.0.0.1-0' listening on '127.0.0.1:8000'
2021-12-21 13:54:57,048	INFO api.py:463 -- Started detached Serve instance in namespace 'summarizer'.
2021-12-21 13:54:57,063	INFO api.py:242 -- Updating deployment 'FastAPIWrapper1'. component=serve deployment=FastAPIWrapper1
(HTTPProxyActor pid=94777) INFO: Started server process [94777]
(ServeController pid=94776) 2021-12-21 13:54:57,129	INFO deployment_state.py:912 -- Adding 1 replicas to deployment 'FastAPIWrapper1'. component=serve deployment=FastAPIWrapper1
2021-12-21 13:54:57,980	INFO api.py:249 -- Deployment 'FastAPIWrapper1' is ready at `http://127.0.0.1:8000/api1`. component=serve deployment=FastAPIWrapper1
2021-12-21 13:54:57,988	INFO api.py:242 -- Updating deployment 'FastAPIWrapper2'. component=serve deployment=FastAPIWrapper2
(ServeController pid=94776) 2021-12-21 13:54:58,085	INFO deployment_state.py:912 -- Adding 1 replicas to deployment 'FastAPIWrapper2'. component=serve deployment=FastAPIWrapper2
2021-12-21 13:54:58,934	INFO api.py:249 -- Deployment 'FastAPIWrapper2' is ready at `http://127.0.0.1:8000/api2`. component=serve deployment=FastAPIWrapper2

```

After deployment, here is successful `curl` calls

```auto
❯ curl http://127.0.0.1:8000/api1/subpath
"Hello 1!"%
❯ curl http://127.0.0.1:8000/api2/subpath
"Hello 2!"%

```

But when I try to run `curl` to root, its failing.

```auto
❯ curl http://127.0.0.1:8000/
Path '/' not found. Please ping http://.../-/routes for route table.%

```

I am trying to assess if any endpoints that are available via FASTapi would still be available or not. Please let me know if I am missing something here.

---

<div class="post-metadata">

**Author:** ![lihost](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/lihost/32/1896_2.png) [@lihost](https://discuss.ray.io/u/lihost)\
**Post date:** [December 21, 2021, 10:18pm UTC](https://discuss.ray.io/t/ray-serve-example-not-working/4502/2 "2021-12-21T22:18:41Z")

</div>

Got it, path `http://127.0.0.1:8000/` is not directly accessible. Due to ingress, its under the route where it is part of.

Changed path as below

```auto
@app.get("/fastapi")
def f():
    return "Hello from the root!"

```

Now I can call

```auto
❯ curl http://127.0.0.1:8000/api1/fastapi
"Hello from the root!"

```
