okteto / movies

React + Node multi service application
Apache License 2.0
77 stars 157 forks source link

We are displaying the api url which isn't handled by the express api #58

Closed AgustinRamiroDiaz closed 1 year ago

AgustinRamiroDiaz commented 2 years ago

When we deploy this app in cloud, we show https://movies-namespace.user.dev.okteto.net/api which is not a valid endpoint of the api. We should modify this endpoint with some config or accept it in the express api in server.js. The latter would look something like this:

      app.get("/api", (req, res, next) => {
        res.json("api is up and running")
        return;
      });

Or a redirect to /api/healthz

pchico83 commented 2 years ago

When we deploy this app in cloud, we show https://movies-namespace.user.dev.okteto.net/api which is not a valid endpoint of the api. We should modify this endpoint with some config or accept it in the express api in server.js. The latter would look something like this:

      app.get("/api", (req, res, next) => {
        res.json("api is up and running")
        return;
      });

Or a redirect to /api/healthz

yes please!

gabriel-okteto commented 2 years ago

would it be worth adding a public static file handler at that location ?

https://movies-gabriel-okteto.cloud.okteto.net/api/
https://github.com/okteto/movies/pull/new/feat-api-route

# ref line 25
app.use('/api', express.static('public'))
pchico83 commented 2 years ago

I would just create the endpoints /api/watching and /api/movies. To do that, you need to add both paths in the Ingress object: https://github.com/okteto/movies/blob/main/chart/templates/ingressv1.yaml#L21 and remove the one for /api

rberrelleza commented 2 years ago

Could we add a static response to /api instead?

rberrelleza commented 1 year ago

Fixed in all fronts