Add crossway api for traffic_lights

This commit is contained in:
David Eder 2021-06-08 14:57:31 +02:00
parent c0a87c7700
commit 026e4d6f9d
2 changed files with 15 additions and 4 deletions

View File

@ -1,5 +1,6 @@
import {Component, OnInit, ViewChild} from '@angular/core'; import {Component, OnInit, ViewChild} from '@angular/core';
import {AgmMap, AgmMarker} from '@agm/core'; import {AgmMap, AgmMarker} from '@agm/core';
import {RestService} from "../../services/rest.service";
@Component({ @Component({
selector: 'app-landing', selector: 'app-landing',
@ -8,7 +9,9 @@ import {AgmMap, AgmMarker} from '@agm/core';
}) })
export class LandingComponent implements OnInit { export class LandingComponent implements OnInit {
constructor() { constructor(
private restService: RestService
) {
} }
@ViewChild('map') map: AgmMap; @ViewChild('map') map: AgmMap;

View File

@ -28,10 +28,18 @@ def get_cars():
return json_util.dumps({'cursor': cars}) return json_util.dumps({'cursor': cars})
@app.route('/api/v1/resources/traffic_lights', methods=['GET'])
def get_traffic_lights():
@app.route('/api2') try:
def api2(): response = requests.get(ENTITY_IDENT_URL + 'traffic_lights')
return 'api2' 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__': if __name__ == '__main__':