<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sosanya Esther </title>
    <description>The latest articles on DEV Community by Sosanya Esther  (@queentiol).</description>
    <link>https://dev.to/queentiol</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2732424%2F85bd8c35-1acc-4f55-a681-640405ab1030.jpg</url>
      <title>DEV Community: Sosanya Esther </title>
      <link>https://dev.to/queentiol</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/queentiol"/>
    <language>en</language>
    <item>
      <title>Response methods</title>
      <dc:creator>Sosanya Esther </dc:creator>
      <pubDate>Sat, 15 Feb 2025 00:03:11 +0000</pubDate>
      <link>https://dev.to/queentiol/response-methods-heo</link>
      <guid>https://dev.to/queentiol/response-methods-heo</guid>
      <description>&lt;p&gt;&lt;strong&gt;What are Response Methods?&lt;/strong&gt;&lt;br&gt;
The Response object (response) provides the HTTP response that an Express app sends when it receives an HTTP request.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Different Types of Response Methods&lt;/strong&gt;&lt;br&gt;
1.&lt;strong&gt;res.send():&lt;/strong&gt; Most people are already familiar with the res.send() method. You can answer HTTP requests with a variety of data types using res. send().&lt;br&gt;
2.&lt;strong&gt;res.json():&lt;/strong&gt; It is used for sending a JSON response. This function uses JSON.stringify() to transform the parameter into a JSON string and sends a response (with the correct content type).&lt;br&gt;
3.&lt;strong&gt;res.status():&lt;/strong&gt; Represents the status of the response, res. status defines the HTTP response code. If an unidentified status code is provided, the response body will just contain the code's numeric value.&lt;br&gt;
Each code will represent a different response state.&lt;br&gt;
-5xx: Server error&lt;br&gt;
-4xx: Error in clients&lt;br&gt;
-3xx: Redirects&lt;br&gt;
-2xx: Success&lt;br&gt;
-1xx : Information&lt;br&gt;
4.&lt;strong&gt;res.download():&lt;/strong&gt; The file at the path is transferred as an "attachment." Browsers will typically prompt the user to download. The path argument is used by default to derive the Content-Disposition header "filename=" parameter, although this can be modified with the filename parameter. If the path is relative, it will be based on the process's current working directory or the root option, if specified.&lt;br&gt;
5.&lt;strong&gt;res.end():&lt;/strong&gt; The response procedure will end using this method. This method was inspired by Node core, notably the response. end() method of HTTP.ServerResponse. Use to swiftly terminate the response with no data. If you want to send the response with data, instead use res. send() and res.json().&lt;br&gt;
6.&lt;strong&gt;res.send file():&lt;/strong&gt; Transfers the file at the specified path. Sets the Content-Type response HTTP header field based on the extension of the filename. The path should be a complete path to the file unless the root option is provided in the options object.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>vscode</category>
    </item>
    <item>
      <title>Differences between req.query,req.param and req.body</title>
      <dc:creator>Sosanya Esther </dc:creator>
      <pubDate>Fri, 14 Feb 2025 23:39:39 +0000</pubDate>
      <link>https://dev.to/queentiol/differences-between-reqqueryreqparam-and-reqbody-45ma</link>
      <guid>https://dev.to/queentiol/differences-between-reqqueryreqparam-and-reqbody-45ma</guid>
      <description>&lt;p&gt;&lt;strong&gt;The req.query&lt;/strong&gt; property allows you to access the query parameters from the URL of an incoming HTTP request.&lt;br&gt;
&lt;strong&gt;The req.params&lt;/strong&gt; property is an object containing properties mapped to the named route “parameters”. &lt;br&gt;
&lt;strong&gt;The req.body&lt;/strong&gt; property contains key-value pairs of data submitted in the request body. By default, it is undefined and is populated when you use a middleware called body-parsing such as express.urlencoded() or express.json(). &lt;/p&gt;

&lt;p&gt;In summary,the difference is that;&lt;strong&gt;req.params&lt;/strong&gt; when you have dynamic segments in your route patterns, &lt;strong&gt;req.query&lt;/strong&gt; when you want to retrieve data from the query string, and &lt;strong&gt;req.body&lt;/strong&gt; for data sent in the request body.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>database</category>
      <category>mongodb</category>
    </item>
    <item>
      <title>Http methods and Codes</title>
      <dc:creator>Sosanya Esther </dc:creator>
      <pubDate>Wed, 29 Jan 2025 17:15:50 +0000</pubDate>
      <link>https://dev.to/queentiol/http-methods-and-codes-e0n</link>
      <guid>https://dev.to/queentiol/http-methods-and-codes-e0n</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is the HTTP?&lt;/strong&gt;&lt;br&gt;
The Hypertext Transfer Protocol (HTTP) is the foundation of communication between clients and servers on the web. HTTP methods play a crucial role in defining how this communication occurs. Each method has a specific purpose and understanding their nuances is essential for effective web development.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are HTTP Methods?&lt;/strong&gt;&lt;br&gt;
HTTP methods, which are also known as HTTP verbs, are responsible for defining the actions that can be performed on resources identified by Uniform Resource Identifiers (URIs)&lt;/p&gt;

&lt;p&gt;HTTP defines several methods, each serving a specific purpose in handling resource requests and responses. The most common HTTP methods include: GET, POST, PUT, DELETE, HEAD, OPTIONS, CONNECT, and TRACE. The GET method retrieves information from the server, while the POST method sends data to the server to create, update, or delete resources. The PUT method is used to update a resource, and the DELETE method is used to delete a resource. The HEAD method retrieves only the header information of a resource, while the OPTIONS method retrieves the available methods that can be used on a resource. The CONNECT method establishes a network connection, and the TRACE method echoes the received request back to the client.&lt;br&gt;
&lt;strong&gt;GET Method:&lt;/strong&gt;&lt;br&gt;
The GET method is one of the simplest and most commonly used HTTP methods. It is used to request data from a specified resource. GET requests are idempotent, meaning multiple identical requests should have the same effect as a single request. The data is included in the URL as parameters. Requests using GET should only retrieve data.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg67y5mx8wh1cw8vnppkp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg67y5mx8wh1cw8vnppkp.png" alt="Image description" width="800" height="186"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;POST Method:&lt;/strong&gt;&lt;br&gt;
POST is used to submit data to be processed to a specified resource. Unlike GET, POST requests do not append data to the URL; instead, they include the data in the request body. This makes it suitable for sending large amounts of data or sensitive information. The POST method is used when you want to send some data to the server, for example, file update, form data, etc. The POST method often causes a change in state or side effects on the server.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwdnqexy80wjnk2obwi1n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwdnqexy80wjnk2obwi1n.png" alt="Image description" width="796" height="517"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PUT Method:&lt;/strong&gt;&lt;br&gt;
PUT is used to update a resource on the server. It requires the client to send the entire updated resource representation. If the resource does not exist, PUT can create a new resource with the provided data. In RESTful web services, the HTTP method PUT is typically used for both creating new data and updating existing data.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbnwx3tdx7mexndvj3rmz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbnwx3tdx7mexndvj3rmz.png" alt="Image description" width="800" height="461"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DELETE Method:&lt;/strong&gt;&lt;br&gt;
DELETE is used to remove a resource from the server. It is an idempotent method, meaning repeated DELETE requests will have the same effect as a single request.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd3h0qdnvrabvhw3l0g3d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd3h0qdnvrabvhw3l0g3d.png" alt="Image description" width="770" height="187"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HEAD Method:&lt;/strong&gt;&lt;br&gt;
The HEAD method is similar to GET, but it retrieves only the headers of a resource without the actual data. It is useful when you need to check the headers before downloading the entire resource.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feny81ez7l6s6e7czc164.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feny81ez7l6s6e7czc164.png" alt="Image description" width="800" height="173"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OPTIONS Method:&lt;/strong&gt;&lt;br&gt;
The OPTIONS method is used to determine the communication options available for a given resource. It helps the client understand which HTTP methods and headers are supported.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4xuuwovvfpb8wydy60eq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4xuuwovvfpb8wydy60eq.png" alt="Image description" width="700" height="206"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PATCH Method:&lt;/strong&gt;&lt;br&gt;
PATCH is used to apply partial modifications to a resource. It is more efficient than PUT when updating only specific fields of a resource.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbhb1t9r4sqtrn7fv3bq0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbhb1t9r4sqtrn7fv3bq0.png" alt="Image description" width="798" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTP status codes&lt;/strong&gt; are three-digit codes that indicate the outcome of an API request. They are included in the API’s response to the API client, and they include important information that helps the client know how to proceed.&lt;br&gt;
&lt;strong&gt;What are the different types of HTTP status codes?&lt;/strong&gt;&lt;br&gt;
HTTP status codes are grouped into five classes, each beginning with a number that represents the type of response. The classes are:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1xx informational responses&lt;/strong&gt;&lt;br&gt;
These codes indicate that the server has received the request and is processing it. They are primarily used to manage communication between the client and server during the early stages of a request-response cycle. Some examples of this type of code are:&lt;/p&gt;

&lt;p&gt;100 Continue: This status code indicates that the initial part of the request has been received and the server would like the client to send the rest of it.&lt;br&gt;
101 Switching Protocols: This status code is used to inform the client that the server is changing the protocol that is being used in the connection.&lt;br&gt;
102 Processing: This status code is an interim response that indicates the server is still processing the request.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2xx success responses&lt;/strong&gt;&lt;br&gt;
These codes indicate that the client’s request was successfully received, understood, and processed by the server. Some of the most common 200 responses are:&lt;/p&gt;

&lt;p&gt;200 OK: This status code indicates that the request was successful, and the server returned the requested data.&lt;br&gt;
201 Created: This status code means that the request was successful, and the server created a new resource.&lt;br&gt;
204 No Content: This status code indicates that the request was successful, but the server did not return any data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3xx redirection responses&lt;/strong&gt;&lt;br&gt;
These codes indicate that the client needs to take additional actions to fulfill the request. They are often used when the requested resource has moved to a different location. Some examples include:&lt;/p&gt;

&lt;p&gt;301 Moved Permanently: This status code indicates that the requested resource has been permanently moved to a new URL. Clients should respond by updating their bookmarks and links to point to the new URL, and search engines should update their indexes with the new location.&lt;br&gt;
303 See Other: This status code indicates that the response is available at a different URL, and the client should perform a GET request to that URL to retrieve the resource.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4xx client error responses&lt;/strong&gt;&lt;br&gt;
These codes indicate that there was an issue with the client’s request, such as a mistyped URL or invalid credentials. The most common 4xx responses include:&lt;/p&gt;

&lt;p&gt;400 Bad Request: This status code indicates that the request was malformed or invalid.&lt;br&gt;
401 Unauthorized: This status code lets the client know that it is not authorized to access the requested resource.&lt;br&gt;
403 Forbidden: This status code communicates that the client is authenticated but not authorized to access the requested resource.&lt;br&gt;
404 Not Found: This status code indicates that the requested resource was not found on the server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5xx server error responses&lt;/strong&gt;&lt;br&gt;
These codes, which indicate that the server encountered an error while trying to fulfill the client’s request, include:&lt;/p&gt;

&lt;p&gt;500 Internal Server Error: This generic error code indicates the server encountered an unexpected condition that prevented it from fulfilling the request.&lt;br&gt;
502 Bad Gateway: This status code indicates that a server acting as a gateway or proxy received an invalid response from an upstream server.&lt;br&gt;
503 Service Unavailable: This status code is returned when the server is temporarily unable to handle the request. It’s often seen during periods of increased traffic or when the server is undergoing maintenance.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>backend</category>
    </item>
    <item>
      <title>Http methods and codes</title>
      <dc:creator>Sosanya Esther </dc:creator>
      <pubDate>Wed, 29 Jan 2025 16:45:41 +0000</pubDate>
      <link>https://dev.to/queentiol/http-methods-and-codes-2a8p</link>
      <guid>https://dev.to/queentiol/http-methods-and-codes-2a8p</guid>
      <description>&lt;p&gt;HTTP methods are used to indicate the action an API client would like to perform on a given resource. Each HTTP method maps to a specific operation, such as creating, reading, updating, or deleting a resource, and an HTTP method must be included with every request to a REST API.&lt;br&gt;
HTTP protocol works by clients sending requests to the servers and servers responding to the requests. We do CRUD operations (Create, Read, Update, Delete) by sending HTTP requests with different HTTP methods, sometimes called HTTP verbs. GET and POST are the most frequently used HTTP methods, but more HTTP methods are to learn. This article will go through different HTTP methods and how to use them when building and using web APIs.&lt;br&gt;
&lt;strong&gt;9 HTTP methods you should know about&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;1.GET Method&lt;/strong&gt;&lt;br&gt;
If we want to retrieve data from a resource like websites, servers or APIs, we send them a GET Request. For example, we send a GET request to the server if we want a list of our customers or a specific customer.&lt;br&gt;
Since the GET method should never change the data on the resources and just read them(read-only), it is considered a Safe Method. Additionally, the Get method is idempotent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to test an API with a GET method?&lt;/strong&gt;&lt;br&gt;
When we want to test an API, the most popular method that we would use is the GET method. Therefore, We expect the following to happen.&lt;/p&gt;

&lt;p&gt;If the resource is accessible, the API returns the 200 Status Code, which means OK.&lt;br&gt;
Along with the 200 Status Code, the server usually returns a response body in XML or JSON format. So, for example, we expect the [GET] /members endpoint to return a list of members in XML or JSON.&lt;br&gt;
If the server does not support the endpoint, the server returns the 404 Status Code, which means Not Found.&lt;br&gt;
If we send the request in the wrong syntax, the server returns the 400 Status Code, which means Bad Request.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.POST Method&lt;/strong&gt;&lt;br&gt;
The POST method creates a new resource on the backend (server). The request body carries the data we want to the server. It is neither a safe nor idempotent method. We don’t expect to get the same result every time we send a POST request. For example, two identical POST requests will create two new equivalent resources with the same data and different resource ids.&lt;/p&gt;

&lt;p&gt;When sending a POST request to a server, we expect the following to happen:&lt;br&gt;
&lt;em&gt;Ideally, if the POST request has created a new resource on the other side, the response should come with 201 Status Code which means Created.&lt;br&gt;
*Sometimes, performing a POST request doesn’t return a resource at the given URL; in this case, the method will return 204 status code which means No content.&lt;br&gt;
**How to test a POST endpoint&lt;/em&gt;*&lt;br&gt;
Since the POST method creates data, we must be cautious about changing data; testing all the POST methods in APIs is highly recommended. Moreover, make sure to delete the created resource once your testing is finished.&lt;/p&gt;

&lt;p&gt;Here are some suggestions that we can do for testing APIs with POST methods:&lt;/p&gt;

&lt;p&gt;Create a resource with the POST method, and it should return the 201 Status Code.&lt;br&gt;
Perform the GET method to check if it created the resource was successfully created. You should get the 200 status code, and the response should contain the created resource.&lt;br&gt;
Perform the POST method with incorrect or wrong formatted data to check if the operation fails.&lt;br&gt;
&lt;strong&gt;3.PUT Method&lt;/strong&gt;&lt;br&gt;
With the PUT request method, we can update an existing resource by sending the updated data as the content of the request body to the server. The PUT method updates a resource by replacing its entire content completely. If it applies to a collection of resources, it replaces the whole collection, so be careful using it. The server will return the 200 or 204 status codes after the existing resource is updated successfully.&lt;br&gt;
&lt;strong&gt;How to test an API with a PUT method?&lt;/strong&gt;&lt;br&gt;
The PUT method is idempotent, and it modifies the entire resources, so to test that behavior, we make sure to do the following operations:&lt;/p&gt;

&lt;p&gt;Send a PUT request to the server many times, and it should always return the same result.&lt;br&gt;
When the server completes the PUT request and updates the resource, the response should come with 200 or 204 status codes.&lt;br&gt;
After the server completes the PUT request, make a GET request to check if the data is updated correctly on the resource.&lt;br&gt;
If the input is invalid or has the wrong format, the resource must not be updated.&lt;br&gt;
&lt;strong&gt;4.PATCH Method&lt;/strong&gt;&lt;br&gt;
PATCH is another HTTP method that is not commonly used. Similar to PUT, PATCH updates a resource, but it updates data partially and not entirely. For example, to make it more precise, the request [PUT] customers/{customerid} would update the fields in the Customers entity on the resource entirely. However, the PATCH method does update the provided fields of the customer entity. In general, this modification should be in a standard format like JSON or XML.&lt;br&gt;
&lt;strong&gt;How to test an API with a PATCH method?&lt;/strong&gt;&lt;br&gt;
To test an API with the PATCH method, follow the steps discussed in this article for the testing API with the PUT and the POST methods. Consider the following results:&lt;/p&gt;

&lt;p&gt;Send a PATCH request to the server; the server will return the 2xx HTTP status code, which means: the request is successfully received, understood, and accepted.&lt;br&gt;
Perform the GET request and verify that the content is updated correctly.&lt;br&gt;
If the request payload is incorrect or ill-formatted, the operation must fail.&lt;br&gt;
&lt;strong&gt;5.DELETE Method&lt;/strong&gt;&lt;br&gt;
As the name suggests, the DELETE method deletes a resource. The DELETE method is idempotent; regardless of the number of calls, it returns the same result.&lt;/p&gt;

&lt;p&gt;Most APIs always return the 200 status code even if we try to delete a deleted resource but in some APIs, If the target data no longer exists, the method call would return a 404 status code.&lt;br&gt;
&lt;strong&gt;How to test a DELETE endpoint?&lt;/strong&gt;&lt;br&gt;
When it comes to deleting something on the server, we should be cautious. We are deleting data, and it is critical. First, make sure that deleting data is acceptable, then perform the following actions.&lt;/p&gt;

&lt;p&gt;Call the POST method to create a new resource. Never test DELETE with actual Data. For example, first, create a new customer and then try to delete the customer you just created.&lt;br&gt;
Make the DELETE request for a specific resource. For example, the request [DELETE] /customers/ {customer-id} deletes a customer with thee specified customer Id.&lt;br&gt;
Call the GET method for the deleted customer, which should return 404, as the resource no longer exists.&lt;br&gt;
Testfully’s Multi-step tests allow you to create resources on the fly and use them for testing DELETE endpoints.&lt;br&gt;
&lt;strong&gt;6.HEAD Method&lt;/strong&gt;&lt;br&gt;
The HEAD method is similar to the GET method. But it doesn’t have any response body, so if it mistakenly returns the response body, it must be ignored. For example, the [GET] /customers endpoint returns a list of customers in its response body. Also, the [HEAD] /customers do the same, but it doesn’t return a list of customers. Before requesting the GET endpoint, we can make a HEAD request to determine the size (Content-length) of the file or data that we are downloading. Therefore, the HEAD method is safe and idempotent.&lt;br&gt;
&lt;strong&gt;How to test a HEAD endpoint&lt;/strong&gt;&lt;br&gt;
One of the advantages of the HEAD method is that we can test the server if it is available and accessible as long as the API supports it, and it is much faster than the GET method because it has no response body. The status code we expect to get from the API is 200. Before every other HTTP method, we can first test API with the HEAD method.&lt;br&gt;
&lt;strong&gt;7.OPTIONS Method&lt;/strong&gt;&lt;br&gt;
We use This method to get information about the possible communication options (Permitted HTTP methods) for the given URL in the server or an asterisk to refer to the entire server. This method is safe and idempotent.&lt;/p&gt;

&lt;p&gt;Various browsers widely use the OPTIONS method to check whether the CORS (Cross-Origin resource sharing) operation is restricted on the targeted API or not.&lt;br&gt;
&lt;strong&gt;How to test an OPTIONS endpoint&lt;/strong&gt;&lt;br&gt;
Depending on whether the server supports the OPTIONS method, we can test the server for the times of FATAL failure with the OPTIONS method. To try it, consider the following.&lt;/p&gt;

&lt;p&gt;Make an OPTIONS request and check the header and the status code that returns.&lt;br&gt;
Test the case of failure with a resource that doesn’t support the OPTIONS method.&lt;br&gt;
&lt;strong&gt;8.TRACE Method&lt;/strong&gt;&lt;br&gt;
The TRACE method is for diagnosis purposes. It creates a loop-back test with the same request body that the client sent to the server before, and the successful response code is 200 OK. The TRACE method is safe and idempotent.&lt;/p&gt;

&lt;p&gt;The TRACE method could be dangerous because it could reveal credentials. A hacker could steal credentials, including internal authentication headers, using a client-side attack.&lt;br&gt;
&lt;strong&gt;How to test an API with a TRACE method?&lt;/strong&gt;&lt;br&gt;
Make a standard HTTP request like a GET request to /api/status&lt;br&gt;
Replace GET with the TRACE and send it again.&lt;br&gt;
Check what the server returns. If the response has the same information as the original request, the TRACE ability is enabled in the server and works correctly.&lt;br&gt;
&lt;strong&gt;9.CONNECT Method&lt;/strong&gt;&lt;br&gt;
The CONNECT method is for making end-to-end connections between a client and a server. It makes a two-way connection like a tunnel between them. For example, we can use this method to safely transfer a large file between the client and the server.&lt;br&gt;
Comparison of HTTP methods&lt;br&gt;
Method  Summary CRUD    Accepts Request Body    Idempotnent Safe&lt;br&gt;
GET To fetch a single resource or group of resources    Read    No  Yes Yes&lt;br&gt;
PUT To update an entire resource in one go  Update  Yes Yes No&lt;br&gt;
POST    To create a new resource    Create  Yes No  No&lt;br&gt;
PATCH   To partially update a resource  Update  Yes No  No&lt;br&gt;
DELETE  To delete a resource    Delete  No  Yes No&lt;br&gt;
OPTIONS To get information on permitted operations  Read    No  Yes Yes&lt;br&gt;
HEAD    To get metadata of the endpoint Read    No  Yes Yes&lt;br&gt;
TRACE   For diagnosing purposes Read    No  Yes Yes&lt;br&gt;
CONNECT To make the two-way connection between the client and the resource. -   No&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>coding</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Inheritance in JavaScript</title>
      <dc:creator>Sosanya Esther </dc:creator>
      <pubDate>Sat, 25 Jan 2025 11:38:53 +0000</pubDate>
      <link>https://dev.to/queentiol/inheritance-in-javascript-49ni</link>
      <guid>https://dev.to/queentiol/inheritance-in-javascript-49ni</guid>
      <description>&lt;p&gt;In programming, inheritance refers to passing down characteristics from a parent to a child so that a new piece of code can reuse and build upon the features of an existing one. JavaScript implements inheritance by using objects. &lt;br&gt;
Inheritance allows you to define a class and then take all the functionality and features of the class and give them to another. The one who gives the features is called the parent class or superclass and the one who inherits the feature is called a child class or subclass. By using inheritance, a class can inherit all the required methods and can also have its unique features.Each object has an internal link to another object called its prototype.&lt;br&gt;
&lt;strong&gt;Types of Inheritance in JavaScript&lt;/strong&gt;&lt;br&gt;
1.&lt;strong&gt;Prototypal Inheritance:&lt;/strong&gt; Prototypal inheritance is a type of inheritance that adds new properties and methods to an existing object.&lt;br&gt;
function Animal(name) {&lt;br&gt;
    this.name = name;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Animal.prototype.sound = function() {&lt;br&gt;
    console.log("Some generic sound");&lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;function Dog(name, breed) {&lt;br&gt;
    Animal.call(this, name);&lt;br&gt;
    this.breed = breed;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Dog.prototype = Object.create(Animal.prototype);&lt;br&gt;
Dog.prototype.constructor = Dog;&lt;/p&gt;

&lt;p&gt;Dog.prototype.sound = function() {&lt;br&gt;
    console.log("Woof! Woof!");&lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;const myDog = new Dog("Buddy", "Labrador");&lt;br&gt;
myDog.sound();  // Outputs: Woof! Woof!&lt;br&gt;
2.&lt;strong&gt;Pseudoclassical Inheritance:&lt;/strong&gt; Psuedoclassical inheritance is similar to prototypal inheritance.In Pseudo classical inheritance, it emulates the classical inheritance by using prototypal inheritance.&lt;br&gt;
class automobile {&lt;br&gt;
    constructor(name, cc) {&lt;br&gt;
        this.name = name;&lt;br&gt;
        this.cc = cc;&lt;br&gt;
    }&lt;br&gt;
    engine() {&lt;br&gt;
        console.log(&lt;code&gt;${this.name} &lt;br&gt;
      has ${this.cc} engine&lt;/code&gt;);&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;class car extends automobile {&lt;br&gt;
    engine() {&lt;br&gt;
        console.log(this.name,&lt;br&gt;
            "has ", this.cc, "cc engine");&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;let carz = new car('Rex', "1149");&lt;br&gt;
carz.engine();&lt;br&gt;
3.&lt;strong&gt;Functional Inheritance:&lt;/strong&gt; From the name of the inheritance, you understand that this type of inheritance in JavaScript makes use of functions. Functional Inheritance uses an augmenting function to the instance of the object in order to inherit the features of that object.&lt;br&gt;
function Animal(name) {&lt;br&gt;
    const obj = {};&lt;br&gt;
    obj.name = name;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;obj.sound = function() {
    console.log(&amp;amp;quot;Some generic sound&amp;amp;quot;);
};

return obj;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;function Dog(name, breed) {&lt;br&gt;
    const obj = Animal(name);&lt;br&gt;
    obj.breed = breed;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;obj.sound = function() {
    console.log(&amp;amp;quot;Woof! Woof!&amp;amp;quot;);
};

return obj;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;const myDog = Dog("Buddy", "Labrador");&lt;br&gt;
myDog.sound();  // Outputs: Woof! Woof!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Scopes in JavaScript</title>
      <dc:creator>Sosanya Esther </dc:creator>
      <pubDate>Fri, 24 Jan 2025 11:28:47 +0000</pubDate>
      <link>https://dev.to/queentiol/scopes-in-javascript-28ec</link>
      <guid>https://dev.to/queentiol/scopes-in-javascript-28ec</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is Scope?&lt;/strong&gt;&lt;br&gt;
Scope in JavaScript refers to the context or environment in which variables are declared and can be accessed.A solid scope is indispensable because it can affect how your code behaves and interacts with other parts of your application.&lt;br&gt;
JavaScript has two types of scope:&lt;br&gt;
1.Local scope&lt;br&gt;
2.Global scope&lt;br&gt;
These scopes control the accessibility of variables in different parts of your code and play a pivotal role in maintaining code organization and preventing variable conflicts.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Local scope:&lt;/strong&gt; Any variable that you declare inside a function is said to have &lt;strong&gt;Local Scope&lt;/strong&gt;. Local variables have Function scope: They can only be accessed from within the&lt;br&gt;
function.Local variables are created when a function starts, and deleted when the function&lt;br&gt;
is completed. If you try to access any variable defined inside a function from outside or another function, it throws an error.Since you cannot access a local variable from outside the function, you can have a variable of the same name in another function as well.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Global scope:&lt;/strong&gt; Any variable declared outside of a function is said to have &lt;strong&gt;Global Scope&lt;/strong&gt;.&lt;br&gt;
In simple terms, a variable that can be accessed anywhere in the program is known as a variable with global scope.&lt;br&gt;
A global variable has global scope: All scripts and functions on a web page can&lt;br&gt;
access it.&lt;br&gt;
Global variables are created when you assign a value to them. Global variables are deleted when you close the page. &lt;br&gt;
Globally scoped variables can be defined using any of the three keywords: let, const, and var. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>vscode</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Constructors in JavaScript</title>
      <dc:creator>Sosanya Esther </dc:creator>
      <pubDate>Sat, 18 Jan 2025 13:06:16 +0000</pubDate>
      <link>https://dev.to/queentiol/constructors-in-javascript-30dg</link>
      <guid>https://dev.to/queentiol/constructors-in-javascript-30dg</guid>
      <description>&lt;p&gt;The Javascript Set Constructor is used to create Set objects. It will create a set of unique values of any type, whether primitive values or object preferences.&lt;br&gt;
&lt;strong&gt;A constructor&lt;/strong&gt; is useful when you want to create multiple similar objects with the same properties and methods. It’s a convention to capitalize the name of constructors to distinguish them from regular functions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F73zum0tiw7zfqg1kxgpx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F73zum0tiw7zfqg1kxgpx.png" alt="Image description" width="768" height="310"&gt;&lt;/a&gt;&lt;br&gt;
The last line of the code creates an instance of Book and assigns it to a variable. Although the Book constructor doesn’t do anything, myBook is still an instance of it. As you can see, there is no difference between this function and regular functions except that it’s called with the new keyword and the function name is capitalized.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A constructor&lt;/strong&gt; is a function that executes the initialization of an object when the object is created. Arguments are passed to the constructor function when you use the new keyword. &lt;br&gt;
There are two types of constructors, one defined as a function, and one defined with the constructor method in a class.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Object Constructor Function:&lt;/strong&gt;&lt;br&gt;
To use a constructor function to create objects, simply define a JavaScript function with any number of arguments. Inside the function, the keyword this is used as a placeholder for the object being created. If the constructor function is used by itself, without the new statement, this will have no value.&lt;br&gt;
It’s preferred to capitalize a constructor function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fge9zr6q44jevpc2req5e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fge9zr6q44jevpc2req5e.png" alt="Image description" width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Class constructor Method:&lt;/strong&gt;&lt;br&gt;
When defining a class in JavaScript, there is a special constructor method defined within it. Like the object constructor function, the constructor method can be defined with any number of arguments, and the this keyword can be used as a placeholder for the object being created.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuf7bsxnqcitl6mgi48vw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuf7bsxnqcitl6mgi48vw.png" alt="Image description" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
      <category>node</category>
    </item>
  </channel>
</rss>
