Jan Plaček
03/14/2022, 9:20 PMAPI_URL: `${staticSite.url}/api`
thdxr
03/14/2022, 9:20 PMthdxr
03/14/2022, 9:20 PMJan Plaček
03/14/2022, 9:22 PMStaticSite
constructor... it's chicken-egg problem...Jan Plaček
03/14/2022, 9:28 PMenvironment
and replaceValues
as callbacks or have staticSite.setEnvironment
and staticSite.setReplaceValues
thdxr
03/14/2022, 10:28 PMthdxr
03/14/2022, 10:28 PMJan Plaček
03/15/2022, 7:48 AMFrank
import { Lazy } from "aws-cdk-lib";
import * as sst from "@serverless-stack/resources";
export class MainStack extends sst.Stack {
constructor(scope: <http://sst.App|sst.App>, id: string) {
super(scope, id);
let site;
// Create StaticSite
site = new sst.StaticSite(this, "Frontend", {
path: "src/sites/website",
environment: {
API_URL: Lazy.stringValue({
produce(context) {
return site.url;
}
})
},
});
}
}
Jan Plaček
03/16/2022, 7:19 PMthdxr
03/16/2022, 7:20 PMlocation
in jsJan Plaček
03/16/2022, 7:24 PMlocalhost
, but API is on actualGeneratedStaticSiteDomain/api
Jan Plaček
03/16/2022, 7:34 PMJan Plaček
03/16/2022, 7:38 PMFrank
Jan Plaček
03/16/2022, 8:44 PMJan Plaček
03/16/2022, 8:46 PMJan Plaček
03/16/2022, 8:48 PMFrank
<http://domain.com|domain.com>
and <http://api.domain.com|api.domain.com>
not an option?Frank