@exanderal/stackcraft 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -80,7 +80,7 @@ async function writeBackendEnv(config) {
80
80
  `DB_NAME=${dbName}`,
81
81
  '',
82
82
  '# App',
83
- 'PORT=3000',
83
+ 'PORT=3001',
84
84
  'NODE_ENV=development',
85
85
  '',
86
86
  ].join('\n');
@@ -92,7 +92,7 @@ async function writeFrontendEnv(config) {
92
92
  const apiVar = FRONTEND_API_VAR[config.frontend];
93
93
  const lines = [
94
94
  '# API',
95
- `${apiVar}=http://localhost:3000`,
95
+ `${apiVar}=http://localhost:3001`,
96
96
  '',
97
97
  ].join('\n');
98
98
  await writeFile(join(webDir, '.env'), lines, 'utf-8');
@@ -60,19 +60,19 @@ async function patchNextLayout(webDir) {
60
60
  await writeFile(layoutPath, patched, 'utf-8');
61
61
  }
62
62
  function apolloViteClient() {
63
- return `import { ApolloClient, InMemoryCache } from '@apollo/client'
63
+ return `import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client'
64
64
 
65
65
  export const client = new ApolloClient({
66
- uri: import.meta.env.VITE_API_URL ?? 'http://localhost:3000/graphql',
66
+ link: new HttpLink({ uri: import.meta.env.VITE_API_URL ?? 'http://localhost:3001/graphql' }),
67
67
  cache: new InMemoryCache(),
68
68
  })
69
69
  `;
70
70
  }
71
71
  function apolloNextClient() {
72
- return `import { ApolloClient, InMemoryCache } from '@apollo/client'
72
+ return `import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client'
73
73
 
74
74
  export const client = new ApolloClient({
75
- uri: process.env.NEXT_PUBLIC_API_URL ?? 'http://localhost:3000/graphql',
75
+ link: new HttpLink({ uri: process.env.NEXT_PUBLIC_API_URL ?? 'http://localhost:3001/graphql' }),
76
76
  cache: new InMemoryCache(),
77
77
  })
78
78
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exanderal/stackcraft",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Opinionated full-stack project scaffolding CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,6 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@apollo/server": "^4.0.0",
25
+ "@as-integrations/express5": "^1.1.2",
25
26
  "@nestjs/apollo": "^13.0.0",
26
27
  "@nestjs/common": "^11.0.1",
27
28
  "@nestjs/config": "^3.0.0",
@@ -1,9 +1,10 @@
1
1
  import { Module } from '@nestjs/common';
2
2
  import { HealthController } from './health.controller';
3
+ import { HealthResolver } from './health.resolver';
3
4
  import { HealthService } from './health.service';
4
5
 
5
6
  @Module({
6
7
  controllers: [HealthController],
7
- providers: [HealthService],
8
+ providers: [HealthService, HealthResolver],
8
9
  })
9
10
  export class HealthModule {}
@@ -0,0 +1,12 @@
1
+ import { Query, Resolver } from '@nestjs/graphql';
2
+ import { HealthService } from './health.service';
3
+
4
+ @Resolver()
5
+ export class HealthResolver {
6
+ constructor(private readonly healthService: HealthService) {}
7
+
8
+ @Query(() => String)
9
+ health(): string {
10
+ return this.healthService.check().status;
11
+ }
12
+ }