I am completely new to Aurelia.
How can I modify the code below in order to implement a dummy HttpClient, such as a json reader, that will provide a static set of json data without the need for a server during development?
import {inject} from 'aurelia-framework';
import {HttpClient} from 'aurelia-fetch-client';
@inject(HttpClient)
export class Users {
heading = 'Sample Users';
users = [];
constructor(http) {
http.configure(config => {
config
.useStandardConfiguration()
.withBaseUrl('https://api.github.com/');
});
this.http = http;
}
activate() {
// Instead of fetching real data from 'users', we can change it to fetch static JSON data here
return Promise.resolve([{ name: 'John Doe', age: 30 }, { name: 'Jane Smith', age: 25 }])
.then(users => this.users = users);
}
}