Next.js Discord

Discord Forum

nestjs

Unanswered
Ivory Gull posted this in #help-forum
Open in Discord
Ivory GullOP
Hey guys,

I am trying to deploy a nx monorepo with a nestjs backend and a react frontend.

this is my vercel.json:
{
  "version": 2,
  "builds": [
    {
      "src": "dist/apps/backend/main.js",
      "use": "@vercel/node"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "dist/apps/backend/main.js",
      "methods": ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]
    }
  ]
}


these are my scripts in my package.json:
  "scripts": {
    "backend": "nx serve backend",

    "landing-page": "nx serve landing-page",
    "start:prod": "node dist/apps/backend/main.js",
    "build": "nx run-many --target=build --projects=backend,landing-page, --parallel=true",
    "dev": "nx run-many --target=serve --all=true",
    "gen:theme-typings": "chakra-cli tokens apps/landing-page/src/theme.ts",
    "postinstall": "npm run gen:theme-typings"
  },


I do serve my react app as static module like this:
    ServeStaticModule.forRoot({
      rootPath: join(__dirname, '..', 'landing-page'),
      exclude: ['/api/(.*)'],
    }),



The setup builds properly but I see the vercel 404 screen when visiting the deployment url.

Does somebody have any experience with this?

2 Replies