Skip to content

Commit

Permalink
Merge pull request #484 from VitNode/codegen_in_dev
Browse files Browse the repository at this point in the history
feat(backend): Add codegen in watch mode
  • Loading branch information
aXenDeveloper authored Sep 5, 2024
2 parents 1a7e2f4 + 08cf532 commit baaf384
Show file tree
Hide file tree
Showing 10 changed files with 1,420 additions and 58 deletions.
16 changes: 1 addition & 15 deletions apps/backend/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
import { INestApplication } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { nestjsMainApp } from 'vitnode-backend';
Expand All @@ -8,20 +7,7 @@ import { AppModule } from './app.module';
async function bootstrap() {
const app: INestApplication = await NestFactory.create(AppModule);

nestjsMainApp(app, {
cors: {
origin: [
process.env.NEXT_PUBLIC_FRONTEND_URL
? process.env.NEXT_PUBLIC_FRONTEND_URL
: 'http://localhost:3000',
],
},
});

const port = Number(process.env.PORT) || 8080;
await app.listen(port, '', () => {
console.log(`Application is running on: http://localhost:${port}/graphql`);
});
void nestjsMainApp(app, {});
}

void bootstrap();
4 changes: 3 additions & 1 deletion apps/docs/content/docs/dev/codegen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ query Test_example_query($cursor: Int, $first: Int) {

## Generate Types

To generate types for your GraphQL schema, run the following command:
VitNode has build-in `codegen` script in `backend`. That mean when you make changes in `backend` code, the VitNode will automatically generate the types for you.

To generate types manualy for your GraphQL schema, run the following command:

import { Tab, Tabs } from 'fumadocs-ui/components/tabs';

Expand Down
Loading

0 comments on commit baaf384

Please sign in to comment.