Chartjs-How can I query data from my Cosmos DB in Angular 7?

0👍

CosmosDB offers a REST API to access documents. For example:

@Injectable({
    providedIn: 'root'
})
export class CosmosDBService {

    constructor(private http: HttpClient) { }

    get(id: string) {
      return this.http.get(
        `https://${account}.documents.azure.com/dbs/${db}/colls/${collection}/docs/${id}`);
    }
}

Of course, you have to take care of access control, and set the right auth headers to the requests (https://learn.microsoft.com/en-us/rest/api/cosmos-db/access-control-on-cosmosdb-resources)

Leave a comment