diff --git a/api/src/app.controller.ts b/api/src/app.controller.ts index cce879e..1af2646 100644 --- a/api/src/app.controller.ts +++ b/api/src/app.controller.ts @@ -6,7 +6,7 @@ export class AppController { constructor(private readonly appService: AppService) {} @Get() - getHello(): string { + getHello(): any { return this.appService.getHello(); } } diff --git a/api/src/app.service.ts b/api/src/app.service.ts index 927d7cc..bbdd038 100644 --- a/api/src/app.service.ts +++ b/api/src/app.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; @Injectable() export class AppService { - getHello(): string { - return 'Hello World!'; + getHello(): any { + return { success: true }; } } diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 7d58cc8..e25f8dc 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -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'; @Component({ @@ -10,4 +11,17 @@ import { RouterOutlet } from '@angular/router'; }) export class AppComponent { title = 'client'; + + private http: HttpClient = inject(HttpClient); + + constructor() { + this.http.get('api/').subscribe({ + next: n => { + console.log(n) + }, + error: e => { + console.log(e) + } + }) + } } diff --git a/client/src/app/app.config.ts b/client/src/app/app.config.ts index a1e7d6f..94f5f50 100644 --- a/client/src/app/app.config.ts +++ b/client/src/app/app.config.ts @@ -2,7 +2,8 @@ import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; import { provideRouter } from '@angular/router'; import { routes } from './app.routes'; +import { provideHttpClient } from '@angular/common/http'; export const appConfig: ApplicationConfig = { - providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes)] + providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes), provideHttpClient()] };