如何将nestjs + graphql部署到now.sh?

时间:2020-02-09 20:09:19

标签: typescript deployment nestjs vercel

问题 嗨,开发人员,

我想看看是否有人可以帮助我如何将nestjs + graphql部署到now.sh。 我已经使用以下命令进行了构建

"build": "nest build",

我尝试进行部署,但是当我转到网址https://animeflv-gql.chrismichael.now.sh/ graphql

它告诉我一个错误

502: BAD_GATEWAY
Code: NO_STATUS_CODE_FROM_FUNCTION
ID: chs1:5ppst-1581278680565-60e10864b74c

now.json

{
  "version": 2,
  "name": "animeflv-gql",
  "builds": [
    {
      "src": "dist/main.js",
      "use": "@now/node"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "dist/main.js"
    }
  ]
}

app.module.ts

import { Module } from '@nestjs/common';
import {GraphQLModule} from '@nestjs/graphql'
import { AnimesModule } from './animes/animes.module';


@Module({
  imports: [
    GraphQLModule.forRoot({
      typePaths: ['./**/*.graphql'],
      resolverValidationOptions:{
        requireResolversForResolveType: false
      },
      playground: true,
    }),
    AnimesModule,
  ],
})
export class AppModule {}

0 个答案:

没有答案