Ross Coundon
03/10/2022, 10:19 PMthdxr
03/10/2022, 10:20 PMRichard Simpson
03/10/2022, 10:22 PMclass Stack
constructor stuff?thdxr
03/10/2022, 10:26 PMfunction Api(props: StackContext) {
const api = new sst.Api(props.stack, "myapi", {...})
return api
}
function Frontend(props: StackContext) {
const api = use(Api)
const site = new sst.StaticSite(props.stack, "mysite", { environment: { API_URL: api.url } })
}
Richard Simpson
03/10/2022, 10:28 PMthis
to the EmptyStack
so new Construct(this, props)
still works? Not sure if there might be a downsidethdxr
03/10/2022, 10:30 PMthis
all togetherRichard Simpson
03/10/2022, 10:30 PMfunction Api(this: Stack, props: StackProps) {
const api = new Api(this, "Api", { /* ... */ });
}
thdxr
03/10/2022, 10:30 PMthdxr
03/10/2022, 10:30 PMnew Api("api", {...})
Richard Simpson
03/10/2022, 10:31 PMCarlos Daniel
03/10/2022, 10:32 PMthdxr
03/10/2022, 10:35 PMthis
is an interesting idea, let me play with it