Sobes.tech
Middle

Andmedaatabasside ja API-dega töötamise teadmine

sobes.tech AI

Vastus AI-lt

For a frontend developer, it is important to understand the basics of working with databases and APIs to efficiently fetch and display data.

Databases:

  • Knowledge of main types of databases: relational (e.g., PostgreSQL, MySQL) and non-relational (e.g., MongoDB).
  • Understanding the principles of CRUD operations (Create, Read, Update, Delete).
  • Basics of SQL queries for selecting and filtering data.

Working with APIs:

  • Understanding REST architecture and main HTTP methods (GET, POST, PUT, DELETE).
  • Ability to send requests to APIs using fetch, axios, or other libraries.
  • Handling API responses, including working with JSON.
  • Error and HTTP status management.

Example of an API request using fetch:

fetch('https://api.example.com/users')
  .then(response => {
    if (!response.ok) {
      throw new Error('Network error');
    }
    return response.json();
  })
  .then(data => {
    console.log(data); // processing received data
  })
  .catch(error => {
    console.error('Error:', error);
  });