initial commit
- contains basic chat via websocket - contains button to test websocket - contains button to test rest api
This commit is contained in:
31
src/app/app.component.ts
Normal file
31
src/app/app.component.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { SocketService } from './socket/socket.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.css']
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'rona-frontend';
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param socketService
|
||||
* @param httpService
|
||||
*/
|
||||
constructor(private socketService: SocketService,
|
||||
private httpService: HttpClient) { }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user