serverless-nextjs / serverless-next.js

⚡ Deploy your Next.js apps on AWS Lambda@Edge via Serverless Components
MIT License
4.43k stars 451 forks source link

How to deploy multiple Nextjs apps to one lambda #327

Open SavageWilliam opened 4 years ago

SavageWilliam commented 4 years ago

We'd like to have a monorepo with 2 NextJS apps that access shared components. We'll deploy either both or one of these apps to various domains.

Zeit's now allows slick deployment of multiple NextJs apps to a singlar lamdba. Routing across these apps in configured in a now.json file.

    "routes": [
        {
            "src": "^/blog(.*)",
            "dest": "apps/blog$1"
        },
        {
            "src": "^(.*)$",
            "dest": "apps/app1$1"
        }
    ]

https://github.com/zeit/now-examples/issues/242

I'd like to do the same using serverless-next as our infra is all aws based. However am not sure of how to create this routing layer.

alexjfno1 commented 4 years ago

Hi @SavageWilliam

I have a similar question too. Have you made any progress on this?

I'd like to have multiple Next.js apps all being served under the same domain. For example:

I haven't found a way to do this with serverless-next yet.

RajanPalaniya commented 3 years ago

any progress on this? i also have similar behaviour but haven't found any solutions right now.

danielcondemarin commented 3 years ago

This was meant to be done as part of https://github.com/serverless-nextjs/serverless-next.js/issues/477 and I mistakenly closed that RFC as only part of it was completed. I've now reopened it.

Please feedback there on the proposed solution using rootPath 👍