Files
street-map-typescript/src/app/photon.service.ts
2022-01-14 09:29:17 +01:00

18 lines
564 B
TypeScript

import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Photon } from './interfaces/photon';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
// communicates with Photon (https://photon.komoot.io/)
export class PhotonService{
constructor(private http: HttpClient) { }
// sends a query request to Photon and gets response (https://photon.komoot.io/)
sendQueryRequest(q: string): Observable<Photon[]> {
return this.http.get<Photon[]>("https://photon.komoot.io/api/?q=" + q);
}
}