diff --git a/angular.json b/angular.json
index 5c36fd4..f0cb141 100644
--- a/angular.json
+++ b/angular.json
@@ -17,7 +17,7 @@
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
- "outputPath": "dist/iisa-web",
+ "outputPath": "./dist/iisa_web",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [
diff --git a/src/app/app.component.html b/src/app/app.component.html
index 36093e1..7073f36 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -333,4 +333,15 @@
+
+@if(this.error){
+
response:
+ {{ this.error }}
+}
+@if (this.response) {
+ response:
+ {{ this.response }}
+}
+
+
diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts
deleted file mode 100644
index c620562..0000000
--- a/src/app/app.component.spec.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { TestBed } from '@angular/core/testing';
-import { AppComponent } from './app.component';
-
-describe('AppComponent', () => {
- beforeEach(async () => {
- await TestBed.configureTestingModule({
- imports: [AppComponent],
- }).compileComponents();
- });
-
- it('should create the app', () => {
- const fixture = TestBed.createComponent(AppComponent);
- const app = fixture.componentInstance;
- expect(app).toBeTruthy();
- });
-
- it(`should have the 'IISA_web' title`, () => {
- const fixture = TestBed.createComponent(AppComponent);
- const app = fixture.componentInstance;
- expect(app.title).toEqual('IISA_web');
- });
-
- it('should render title', () => {
- const fixture = TestBed.createComponent(AppComponent);
- fixture.detectChanges();
- const compiled = fixture.nativeElement as HTMLElement;
- expect(compiled.querySelector('h1')?.textContent).toContain('Hello, IISA_web');
- });
-});
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index fb6b082..27363b6 100644
--- a/src/app/app.component.ts
+++ b/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({
@@ -9,4 +10,14 @@ import { RouterOutlet } from '@angular/router';
})
export class AppComponent {
title = 'IISA_web';
+ httpClient = inject(HttpClient);
+ response: any | null = null;
+ error: any | null = null;
+
+ sendRequest(){
+ this.httpClient.get('http://localhost:3000/app/candidates').subscribe({
+ next: (res) => this.response = JSON.stringify(res),
+ error: err => this.error = JSON.stringify(err)
+ })
+ }
}
diff --git a/src/app/app.config.ts b/src/app/app.config.ts
index a1e7d6f..94f5f50 100644
--- a/src/app/app.config.ts
+++ b/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()]
};