Pål Brattberg
03/29/2021, 10:53 AM'GET /root/sub'
could I do: 'GET /${myvar}/sub'
?
2. I would like to use a previously defined Function as the handler for a route, but can't seem to figure out the syntax. Is this possible?Pål Brattberg
03/29/2021, 12:13 PMaddRoutes
.
this.routes = {}
this.routes[`GET /${id}/ping`] = { authorizationType: sst.ApiAuthorizationType.NONE, function: `services/${id}/handler.ping` }
this.routes[`GET /${id}/secure-ping`] = `services/${id}/handler.securePing`
props.api.addRoutes(this, this.routes)
Pål Brattberg
03/29/2021, 12:13 PMFrank
this.routes[`GET /${id}/ping`] = { authorizationType: sst.ApiAuthorizationType.NONE, function: myFunction }
Or
this.routes[`GET /${id}/secure-ping`] = myFunction;
Frank
Pål Brattberg
03/29/2021, 2:32 PMPål Brattberg
03/29/2021, 2:32 PMdefaultFunctionProps
on my API this was a no-go: Error: Cannot define defaultFunctionProps when a Function is passed in to the routes
Frank
defaultFunctionProps
in this case instead of throwing the error. What do you think?Pål Brattberg
03/29/2021, 7:07 PMdefaultFunctionProps
with whatever is defined on the function if that's possible? But even if it's not, perhaps a notice/warning that defaultFunctionProps
will not affect routes defined with a full function?
Would it be possible to merge the props?Frank
Function
props can’t be updated once created. So probably can’t merge if a Function
is passed in.Pål Brattberg
03/29/2021, 7:20 PMPål Brattberg
03/29/2021, 7:20 PMFrank
Frank
environment
inside defaultFunctionProps
will be merged with the ones defined at the function level.Frank
app.setDefaultFunctionProps
to configure all functions in the app. Example here - https://docs.serverless-stack.com/constructs/App#specifying-default-function-propsPål Brattberg
04/06/2021, 7:48 AM