Once you've constructed an `api`, is there anyway ...
# help
m
Once you've constructed an
api
, is there anyway to retrieve the routes it was configured with?
f
Hey @Michael Wolfenden! Not currently. What’s ur usecase?
Let me know and I can put something in.
m
So I'm creating the api, but then I need to create numerous alarms and dashboard graphs per route So I have to resort to
Copy code
const apiProps: ApiProps = {
    ...
}

const api = new sst.Api(scope, 'api', apiProps)
const routes = apiProps.routes

addAlarms(scope, routes)
addDashboard(scope, routes)
rather than
Copy code
const api = new sst.Api(scope, 'api', {
    ...
})
const routes = apiProps.routes

addAlarms(scope, routes)
addDashboard(scope, routes)
f
I see. If
api.routes
returned
Copy code
[
  "GET /notes",
  "GET /notes/{noteId}",
  ...
]
Would that work for you?
m
Yep, just the
routeKeys
are enough, that way I can call
api.getFunction
f
Got it! Let me put something in tonight or tmr and I will cut a release.
Hey @Michael Wolfenden, added this in v0.32.0.
api.routes
will give you all the route keys.