This is a solution to the challenge GitHub user search app.
In this project I was able to put into practice the MVC architecture
- MVC architecture: a pattern of software architecture responsible for contributing to the optimization of speed between requests made by user commands.
// State
export const state = {
users: {},
darkMode: "",
};
// HTTP/API
const res = await Promise.race([
fetch(`${API_URL}${query}`),
timeout(TIMEOUT_API),
]);
// Searching for information in the model
await model.searchUserGitHub(query);
// Sending information to the View
resultsView.render(model.state.users);
errorMessage() {
const markup = `
<span class="content__results">No results</span>
`;
this._parentForm.insertAdjacentHTML("afterbegin", markup);
}