This commit is contained in:
Bastian Wagner
2024-09-12 16:01:34 +02:00
parent 4e0c212186
commit 14ef69bc58
4 changed files with 20 additions and 5 deletions

View File

@@ -6,7 +6,7 @@ export class AppController {
constructor(private readonly appService: AppService) {} constructor(private readonly appService: AppService) {}
@Get() @Get()
getHello(): string { getHello(): any {
return this.appService.getHello(); return this.appService.getHello();
} }
} }

View File

@@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common';
@Injectable() @Injectable()
export class AppService { export class AppService {
getHello(): string { getHello(): any {
return 'Hello World!'; return { success: true };
} }
} }

View File

@@ -1,4 +1,5 @@
import { Component } from '@angular/core'; import { HttpClient } from '@angular/common/http';
import { Component, inject } from '@angular/core';
import { RouterOutlet } from '@angular/router'; import { RouterOutlet } from '@angular/router';
@Component({ @Component({
@@ -10,4 +11,17 @@ import { RouterOutlet } from '@angular/router';
}) })
export class AppComponent { export class AppComponent {
title = 'client'; title = 'client';
private http: HttpClient = inject(HttpClient);
constructor() {
this.http.get('api/').subscribe({
next: n => {
console.log(n)
},
error: e => {
console.log(e)
}
})
}
} }

View File

@@ -2,7 +2,8 @@ import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router'; import { provideRouter } from '@angular/router';
import { routes } from './app.routes'; import { routes } from './app.routes';
import { provideHttpClient } from '@angular/common/http';
export const appConfig: ApplicationConfig = { export const appConfig: ApplicationConfig = {
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes)] providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes), provideHttpClient()]
}; };