SalihaPopal / Coursework-Planner

Your coursework planner
0 stars 0 forks source link

[TECH ED] Prepare for live session #73

Open SalihaPopal opened 1 year ago

SalihaPopal commented 1 year ago

From Coursework-Planner created by SalihaPopal: SalihaPopal/Coursework-Planner#72

From Module-Node created by Dedekind561: CodeYourFuture/Module-Node#1

Link to the coursework

Node Week 1 playlist

Why are we doing this?

It is essential to start learning new concepts and ideas before Saturday's session. During the week, we expect you to get stuck and form questions about the new content so you can address misconceptions during Saturday's session. The prep work here will introduce you to the new concepts for the week.

Maximum time in hours (Tech has max 16 per week total)

3

How to get help

Share your blockers in your class channel https://syllabus.codeyourfuture.io/guides/asking-questions

SalihaPopal commented 1 year ago

Thank you for asking all these questions. Answering these questions really improves my knowledge.

Define an interfac: Brief (An interface is for example web page, car dashboard where the end user see the product.) Details (In trems of programming it is the way that a software object interacts with the outside world using API. Coffee machines, washing machines and computers that we are using would be examples of interface. Anything that is public on our objects is part of its interface. We don’t need to know how the serial port of a laptop or the break of a car works outside of what is designed by the interface. We don’t need to know the source code of the firmware inside that makes then operate. We just need to know what the interface does.

Interface allows us to communicate with programs by understanding the input and output from programs. A great thing about the interface is that they can allow us to hide the implementation details of that interface inside the object and save the outside world from having care about that.

List Three thing that are part of Node js API. ( Node.js itself is not an API, but it provides a rich ecosystem and platform that allows developers to build APIs. Here are three essential components or aspects commonly associated with building APIs using Node.js: HTTP Module: The HTTP module is a core module in Node.js that provides functionality for handling HTTP requests and responses. It allows developers to create an HTTP server, handle different HTTP methods (GET, POST, PUT, DELETE), parse request data, set response headers, and send response data. The HTTP (path/ working directory) module forms the foundation for building APIs in Node.js. fs (file system): allows usto access to the file server file system like move, add, delete, etc. Like terminal. Middleware: Middleware functions are a crucial aspect of building APIs in Node.js. Middleware sits between the incoming request and the final handler function, allowing developers to add custom logic, perform authentication, handle error handling, and execute other operations. Middleware functions can be used to modify the request or response objects, invoke the next middleware function, or terminate the request-response cycle.

List 3 things that are part of the Jest API. Jest is a popular JavaScript testing framework commonly used for testing JavaScript applications, including Node.js applications. Here are three important components or features that are part of the Jest API: Test Matchers: Jest provides a wide range of built-in matchers that allow you to write expressive and precise assertions in your tests. Matchers are functions that allow you to check if a value meets certain conditions. Some examples of Jest matchers include toEqual for deep equality comparison, toBe for strict equality comparison, toContain for array or string containment check, and toThrow for testing if a function throws an error. Test Runner: The Jest test runner is a core part of the Jest API. It executes your test suites, collects test results, and generates detailed reports. The test runner manages the execution of test files, including handling asynchronous code, tracking test coverage, and reporting test results. It provides a command-line interface (CLI) for running tests, as well as configuration options for customizing test behavior. Mocking and Spying: Jest offers powerful mocking and spying capabilities that allow you to replace dependencies with mock implementations and track function calls. With Jest's mocking API, you can mock modules, functions, and even entire libraries. This enables you to isolate code under test, simulate behavior, and control side effects. Jest also provides spying functions to track function calls, such as jest.fn() to create a mock function and jest.spyOn() to spy on existing functions. These components and features form the core of the Jest API and enable you to write comprehensive and reliable tests for your JavaScript applications. Jest's matchers, test runner, and mocking/spying capabilities provide a robust testing framework for writing unit tests, integration tests, and other types of tests in a convenient and intuitive manner.

List 3 things that are part of the Spotify API The Spotify API provides developers with access to various features and functionality of the Spotify music platform. Here are three important components or features that are part of the Spotify API: Authorization and Authentication: The Spotify API offers authentication mechanisms to allow users to grant access to their Spotify accounts. It supports both user authorization (through the Authorization Code Flow or Implicit Grant Flow) and client authorization (for server-to-server communication). The API provides endpoints and workflows for obtaining access tokens, refreshing tokens, and verifying user authentication. Music Metadata and Playback: The Spotify API allows developers to retrieve rich music metadata, including information about artists, albums, tracks, playlists, and genres. It provides endpoints to search for music, get details about specific tracks or albums, and access featured playlists. Additionally, the API supports controlling playback of music on Spotify-enabled devices, such as starting, pausing, skipping tracks, and controlling volume. User Profiles and Personalization: The Spotify API enables developers to access user-related data and personalize experiences. It allows fetching user profiles, retrieving user playlists, accessing a user's saved tracks and albums, and creating and modifying playlists. The API also provides endpoints for getting recommendations based on user preferences, including recommended tracks, artists, and genres. These components and features of the Spotify API allow developers to build applications and services that integrate with the Spotify music platform. With authorization and authentication, music metadata and playback capabilities, and user profiles and personalization features, developers can create Spotify-powered experiences, including music discovery, playlist management, and personalized recommendations.

Explain why Jest is not a web-based API and why Spotify is a web-based API.

Jest is not a web-based API because it is primarily a JavaScript testing framework designed to run within a JavaScript environment, such as Node.js. Jest focuses on providing tools and functionality for writing and executing tests for JavaScript applications, including unit tests, integration tests, and other types of automated tests. It does not directly interact with web-based protocols or APIs. Jest runs within the JavaScript runtime environment and provides a test runner, assertions, matchers, and other testing utilities. It allows developers to write and run tests in a standalone JavaScript environment without the need for a web browser. Jest is commonly used in Node.js projects, where it can be integrated with build systems or test frameworks to automate the testing process. On the other hand, Spotify is a web-based API because it provides a web service that exposes endpoints and protocols for accessing Spotify's music platform over the internet. It is designed to enable developers to interact with Spotify's resources, retrieve data about music, manage user profiles, and perform other operations related to the Spotify service. Developers can make HTTP requests to Spotify's API endpoints using web-based protocols like HTTP and HTTPS. The responses from the Spotify API are typically in formats like JSON or XML, which can be consumed by web applications, mobile apps, or any software capable of making HTTP requests. Spotify's API is web-based because it follows the principles and conventions of web APIs, using standard web protocols, data formats, and RESTful design principles. It allows developers to build web applications, mobile apps, or any client-side software that integrates with Spotify's music platform and services. In summary, Jest is not a web-based API as it is a JavaScript testing framework focused on running tests within a JavaScript environment, while Spotify's API is web-based as it provides web endpoints and protocols for interacting with Spotify's music platform over the internet.