diff --git a/components/control_center/src/app/component/landing/landing.component.ts b/components/control_center/src/app/component/landing/landing.component.ts index 4374f17..e8a24fe 100644 --- a/components/control_center/src/app/component/landing/landing.component.ts +++ b/components/control_center/src/app/component/landing/landing.component.ts @@ -1,5 +1,6 @@ import {Component, OnInit, ViewChild} from '@angular/core'; import {AgmMap, AgmMarker} from '@agm/core'; +import {RestService} from "../../services/rest.service"; @Component({ selector: 'app-landing', @@ -8,7 +9,9 @@ import {AgmMap, AgmMarker} from '@agm/core'; }) export class LandingComponent implements OnInit { - constructor() { + constructor( + private restService: RestService + ) { } @ViewChild('map') map: AgmMap; diff --git a/components/x_way/x_way_server.py b/components/x_way/x_way_server.py index b98b89d..b094262 100644 --- a/components/x_way/x_way_server.py +++ b/components/x_way/x_way_server.py @@ -28,10 +28,18 @@ def get_cars(): return json_util.dumps({'cursor': cars}) +@app.route('/api/v1/resources/traffic_lights', methods=['GET']) +def get_traffic_lights(): -@app.route('/api2') -def api2(): - return 'api2' + try: + response = requests.get(ENTITY_IDENT_URL + 'traffic_lights') + traffic_lights = response.json()['cursor'] + + except requests.exceptions.ConnectionError as e: + print("Is the entity_ident_server running and reachable?") + raise e + + return json_util.dumps({'cursor': traffic_lights}) if __name__ == '__main__':