diff --git a/src/app/test/test.component.css b/src/app/test/test.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/test/test.component.html b/src/app/test/test.component.html new file mode 100644 index 0000000..08fe1cd --- /dev/null +++ b/src/app/test/test.component.html @@ -0,0 +1,15 @@ +
+
+
+ + + Send test message +
+ +
+ + + Call rest api +
+
+
diff --git a/src/app/test/test.component.spec.ts b/src/app/test/test.component.spec.ts new file mode 100644 index 0000000..ef4e38c --- /dev/null +++ b/src/app/test/test.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TestComponent } from './test.component'; + +describe('TestComponent', () => { + let component: TestComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TestComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TestComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/test/test.component.ts b/src/app/test/test.component.ts new file mode 100644 index 0000000..2d9218e --- /dev/null +++ b/src/app/test/test.component.ts @@ -0,0 +1,29 @@ +import { Component, OnInit } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import {SocketService} from '../socket/socket.service'; + +@Component({ + selector: 'app-test', + templateUrl: './test.component.html', + styleUrls: ['./test.component.css'] +}) +export class TestComponent implements OnInit { + + onClickSocket() { + this.socketService.send('test', {'user': 'USERNAME', 'payload': 'PAYLOAD TEST'}) + } + + onClickApi() { + this.httpService.get('http://localhost:5005/').subscribe(response => { + console.log('REST API call returned: ', response); + }); + } + + constructor(private httpService: HttpClient, + private socketService: SocketService, + ) { } + +ngOnInit(): void { + } + +}