#nestjs

3 messages · Page 1 of 1 (latest)

void pasture
#

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?

sand swiftBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

void pasture