https://serverless-stack.com/ logo
#help
Title
# help
k

Karolis Stulgys

04/28/2022, 12:51 PM
Can I have multiple frontends?
Copy code
const frontendOne = new sst.NextjsSite(this, "frontendOne", {
      path: "frontendOne",
    });
    const frontendTwo = new sst.NextjsSite(this, "frontendTwo", {
      path: "frontendTwo",
    });

    this.addOutputs({
      SiteUrl: frontendOne.customDomainUrl || frontendOne.url,
      ApiEndpoint: api.customDomainUrl || api.url,
    });
That probably needs to be a different stack I guess
f

Frank

04/28/2022, 5:54 PM
That should work. R u getting an error?
k

Karolis Stulgys

04/28/2022, 6:12 PM
Take a closer look. There is frontendTwo. How can I add that?
d

Danny

04/28/2022, 8:27 PM
by adding a second SiteUrl like output
k

Karolis Stulgys

04/29/2022, 5:52 AM
@Danny like
Copy code
this.addOutputs({
      SiteUrl: frontendOne.customDomainUrl || frontendOne.url,
      SiteUrl: frontendTwo.customDomainUrl || frontendTwo.url,
    });
I might did not understand you, but that's not goona work right?
d

Danny

04/29/2022, 9:12 AM
That’s an invalid object. I was thinking
Copy code
this.addOutputs({
      SiteUrl: frontendOne.customDomainUrl || frontendOne.url,
      SiteUrl2: frontendTwo.customDomainUrl || frontendTwo.url,
    });
k

Karolis Stulgys

04/29/2022, 9:48 AM
Oh I see, I didn't realise that addOutputs object param keys can be whatever. Will test this out