<?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>Forem: Sanjay Singh Rajpoot</title>
    <description>The latest articles on Forem by Sanjay Singh Rajpoot (@sanjaysinghrajpoot).</description>
    <link>https://forem.com/sanjaysinghrajpoot</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%2F533777%2F8cee027b-aa4b-4399-9aec-82a4860dbcbf.jpeg</url>
      <title>Forem: Sanjay Singh Rajpoot</title>
      <link>https://forem.com/sanjaysinghrajpoot</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sanjaysinghrajpoot"/>
    <language>en</language>
    <item>
      <title>What are GoRoutines in GoLang?</title>
      <dc:creator>Sanjay Singh Rajpoot</dc:creator>
      <pubDate>Sat, 28 Jan 2023 16:40:49 +0000</pubDate>
      <link>https://forem.com/sanjaysinghrajpoot/what-are-goroutines-in-golang-19mh</link>
      <guid>https://forem.com/sanjaysinghrajpoot/what-are-goroutines-in-golang-19mh</guid>
      <description>&lt;p&gt;GoRoutines are one of the most unique and most used feature of Golang. Goroutines are used to person concurrent tasks. A goroutine is simply a lightweight execution thread and a function that executes concurrently with the rest of the program. The cost of creating a Goroutine is tiny when compared to a thread.&lt;/p&gt;

&lt;p&gt;Before we dive deep into the GoRoutines lets first understand the meaning of Concurrency.&lt;/p&gt;

&lt;h3&gt;
  
  
  Concurrency and Parallelism
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Concurrency is when two or more tasks can start, run, and complete in overlapping time periods. It doesn't necessarily mean they'll ever both be running at the same instant. Concurrency is a semantic property of a program or system. Concurrency is when multiple tasks are in progress for overlapping periods of time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Parallelism is about multiple tasks or subtasks of the same task that literally run at the same time on hardware with multiple computing resources like a multi-core processors. Parallelism is an implementation property. Parallelism is literally the simultaneous physical execution of tasks at runtime, and it requires hardware with multiple computing resources. It resides on the hardware layer.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For Example - if you are listening to music and reading at the same time then it is parallelism because you are doing two tasks at the same time. If you are listening to music and for a moment you paused the music and start reading, then you again start the music and pause the reading, that is concurrency. Here the two tasks were done together but not at the same time, hence concurrent.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are GoRoutines?
&lt;/h3&gt;

&lt;p&gt;A goroutine is a lightweight thread managed by the Go runtime. We, use goroutines to create concurrent programs. Concurrent programs are able to run multiple processes at the same time. Giving us the power to simultaneously process information while saving time. Goroutines are lightweight abstractions over threads because their creation and destruction are very cheap as compared to threads, and they are scheduled over OS threads. To create you just have to start the file with &lt;code&gt;go&lt;/code&gt; word, here is an example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import (  
    "fmt"
)

func hello() {  
    fmt.Println("Hello world goroutine")
}

func main() {  
    go hello()  // a go routine
    fmt.Println("main function")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;go hello()&lt;/code&gt; starts a new Goroutine. Now the &lt;code&gt;hello()&lt;/code&gt; function will run concurrently along with the &lt;code&gt;main()&lt;/code&gt; function. The main function runs in its own Goroutine and it's called the main Goroutine.&lt;/p&gt;

&lt;p&gt;To understand its working we have to keep a few things in mind. When a new Go routine is created it will run inside a parent Go routine which is the file that is executing the code. If the code inside the file ends or the parent thread is finished executing then it will also terminate the child routine. hence only main function is printed and the &lt;code&gt;hello()&lt;/code&gt; routine is terminated along with the parent in the next line. The main Goroutine should be running for any other goroutine to run. If the main Goroutine terminates then the program will be terminated and no other Goroutine will run. That's the secret sauce.&lt;/p&gt;

&lt;p&gt;Think yourself how to fix we need some delay so that the &lt;code&gt;hello()&lt;/code&gt; routine is done executing and then we jump to the next line. For that what do we need? A simple delay that's it!!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import (  
    "fmt"
    "time"
)

func hello() {  
    fmt.Println("Hello world goroutine")
}
func main() {  
    go hello()
    time.Sleep(1 * time.Second)  // here is the delay 
    fmt.Println("main function")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will wait for 1 sec, in that time the go routine can execute itself. Now the call to &lt;code&gt;go hello()&lt;/code&gt; has enough time to execute before the main Goroutine terminates. This program first prints Hello world goroutine, After 1 sec we start reading from the next line. In the same fashion, we can create multiple Go routines as per our needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  What makes them different from threads?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Channels: Goroutines have an easy communication medium known as channels. Due to the presence of channel one, the goroutine can communicate with other goroutines with low latency. Thread does not have an easy communication medium. Due to the lack of easy communication medium inter-thread communicate takes place with high latency.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Setup and Teardown cost: Threads have significant setups and teardown costs because it has to request resources from the OS and return it once it’s done. While Goroutines are created and destroyed by the go runtime (it manages scheduling, garbage collection, and the runtime environment for Goroutines) and those operations are pretty cheap.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Switch cost: This difference is mainly because of the difference in the scheduling of Goroutines and threads. Threads are scheduled preemptively (If a process is running for more than a scheduler time slice, it would preempt the process and schedule execution of another runnable process on the same CPU), the schedular needs to save/restore all registers&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2Fehuyc6tstpw5kmd1u3c0.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%2Fehuyc6tstpw5kmd1u3c0.png" alt="Image description" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How are Go routines Executed?
&lt;/h3&gt;

&lt;p&gt;There are three entities Go uses to explain the Goroutine scheduling.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Processor (P)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;OSThread (M)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Goroutines (G)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Go works on a type of scheduler called an m:n scheduler (M:N scheduler), which states that M number of goroutines can be distributed over N number of OS threads. Comparatively, OS threads have much more overhead than goroutines. Therefore, Go uses a limited number of threads to run a maximum number of goroutines.&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%2Fn5bf07p0knupq6blf0qi.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%2Fn5bf07p0knupq6blf0qi.png" alt="Image description" width="800" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go scheduler distribute runnable goroutines over multiple worker OS threads that runs on one or more processors. Every P has a local Goroutine queue. There’s also a global Goroutine queue which contains runnable Goroutines. Each M should be assigned to a P. Ps may have no Ms if they are blocked or in a system call.&lt;/p&gt;

&lt;p&gt;At any time, there are at most GOMAXPROCS number of P and only one M can run per P. More Ms can be created by the scheduler if required. In each round of scheduling, scheduler finds a runnable G and executes it. Once a runnable G is found, it gets executed until it is blocked.&lt;/p&gt;

&lt;p&gt;If you made it this far don't forget to drop by and leave a comment!!&lt;/p&gt;

&lt;p&gt;References&lt;br&gt;
&lt;a href="https://riteeksrivastava.medium.com/a-complete-journey-with-goroutines-8472630c7f5c" rel="noopener noreferrer"&gt;https://riteeksrivastava.medium.com/a-complete-journey-with-goroutines-8472630c7f5c&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://riteeksrivastava.medium.com/a-complete-journey-with-goroutines-8472630c7f5c" rel="noopener noreferrer"&gt;https://riteeksrivastava.medium.com/a-complete-journey-with-goroutines-8472630c7f5c&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://riteeksrivastava.medium.com/a-complete-journey-with-goroutines-8472630c7f5c" rel="noopener noreferrer"&gt;https://riteeksrivastava.medium.com/a-complete-journey-with-goroutines-8472630c7f5c&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank You!!&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>html</category>
      <category>css</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Docker and Docker Containers Explained</title>
      <dc:creator>Sanjay Singh Rajpoot</dc:creator>
      <pubDate>Sun, 08 Jan 2023 06:13:00 +0000</pubDate>
      <link>https://forem.com/sanjaysinghrajpoot/docker-and-docker-containers-explained-1bic</link>
      <guid>https://forem.com/sanjaysinghrajpoot/docker-and-docker-containers-explained-1bic</guid>
      <description>&lt;h3&gt;
  
  
  Let's first start with Docker
&lt;/h3&gt;

&lt;p&gt;Docker is a powerful tool for building, distributing, and running applications in containers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;To get started with Docker, you'll first need to install it on your machine. You can find installation instructions for Docker here: &lt;a href="https://docs.docker.com/engine/install/" rel="noopener noreferrer"&gt;https://docs.docker.com/engine/install/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once you have Docker installed, you can begin using it to create and run containers. Containers allow you to package your application and its dependencies together, making it easy to deploy and run your application in any environment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To create a Docker container, you'll need a Dockerfile. A Dockerfile is a simple text file that specifies the commands to be run to build a Docker image.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can use the docker build command to build a Docker image from a Dockerfile. For example: docker build -t my-image .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once you have a Docker image, you can use the docker run command to create and start a container from the image. For example: docker run -it my-image bash&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Docker Containers
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Docker containers are a lightweight and portable way to package and run applications. They allow you to package your application and its dependencies together, making it easy to deploy and run your application in any environment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Containers are created from Docker images, which are executable packages that include everything your application needs to run. You can build your own images, or you can use pre-existing images from a registry like Docker Hub.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To create a container, you can use the docker run command. This command creates a new container from an image and starts the container running. For example: docker run -it my-image bash&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Containers are isolated from one another, so you can run multiple containers on a single machine without them interfering with each other. This makes it easy to scale your applications and run multiple instances of them on the same host.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Containers are also ephemeral, meaning that they are created, run, and then discarded when they are no longer needed. This makes them very lightweight and easy to manage.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In addition to running containers, Docker also provides tools for managing and deploying containers at scale. You can use Docker Compose to define and run multi-container applications, and you can use Docker Swarm to create a cluster of Docker engines for deploying and scaling your applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;That's a quick overview of Docker containers! If you want to learn more, check out the official Docker documentation: docs[.]docker[.]com. There are also plenty of online resources and tutorials available to help you get started with using containers.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  webdevelopment #docker #containers
&lt;/h1&gt;

</description>
      <category>watercooler</category>
      <category>discuss</category>
    </item>
    <item>
      <title>ACID properties of Database Explained</title>
      <dc:creator>Sanjay Singh Rajpoot</dc:creator>
      <pubDate>Thu, 05 Jan 2023 18:58:09 +0000</pubDate>
      <link>https://forem.com/sanjaysinghrajpoot/acid-properties-of-database-explained-3m2p</link>
      <guid>https://forem.com/sanjaysinghrajpoot/acid-properties-of-database-explained-3m2p</guid>
      <description>&lt;p&gt;ACID (Atomicity, Consistency, Isolation, Durability) is a set of properties that define the behavior of a SQL database. These properties ensure that database transactions are processed reliably and consistently, even in the face of system failures or concurrent access by multiple users.&lt;/p&gt;

&lt;h3&gt;
  
  
  Atomicity
&lt;/h3&gt;

&lt;p&gt;Atomicity ensures that a database transaction is treated as a single unit of work, and either all of its operations are completed, or none of them are. If a transaction fails, any changes made by the transaction are rolled back, leaving the database in a consistent state.&lt;/p&gt;

&lt;p&gt;Example: Imagine that you are transferring money from one bank account to another. This process involves two steps: withdrawing money from the first account, and depositing it into the second account. Atomicity ensures that these two steps are treated as a single unit of work, and either both are completed, or neither are. For example, if the withdrawal is successful but the deposit fails, the entire transaction will be rolled back and the money will not be transferred.&lt;/p&gt;

&lt;h3&gt;
  
  
  Consistency
&lt;/h3&gt;

&lt;p&gt;Consistency ensures that a database is always in a valid state, and that any transaction that is committed leaves the database in a consistent state. This means that a transaction cannot violate any of the database's constraints or rules.&lt;/p&gt;

&lt;p&gt;Example: Imagine that you are creating a new user account in a database. The database has a constraint that requires all user names to be unique. Consistency ensures that the database remains in a consistent state, and that any transaction that is committed leaves the database in a consistent state. This means that if you try to create a new user with a name that is already in use, the transaction will fail and the database will not be changed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Isolation:
&lt;/h3&gt;

&lt;p&gt;Isolation ensures that concurrent transactions do not interfere with each other. Each transaction operates on a snapshot of the database, and the changes made by one transaction are not visible to other transactions until the transaction is committed. This prevents data from being corrupted by concurrent access.&lt;/p&gt;

&lt;p&gt;Example: Imagine that two users are trying to update the same record in a database at the same time. Isolation ensures that the changes made by one user are not visible to the other user until the transaction is committed. For example, if one user changes the name of the record from "John" to "Jane", and the other user changes the name from "John" to "Jack", the final name of the record will be either "Jane" or "Jack", but not both.&lt;/p&gt;

&lt;h3&gt;
  
  
  Durability
&lt;/h3&gt;

&lt;p&gt;Durability ensures that once a transaction is committed, its changes are permanent and cannot be lost due to system failures. This is typically achieved through the use of a database log, which records the changes made by each transaction, and can be used to recover the database in the event of a failure.&lt;/p&gt;

&lt;p&gt;Example: Imagine that you have just committed a transaction that updates a record in a database. Durability ensures that the changes made by the transaction are permanent and cannot be lost due to system failures. For example, if the database system crashes before the transaction is written to the log, the log can be used to restore the database to a consistent state and commit the transaction once the system is back up. This ensures that the changes made by the transaction are not lost.&lt;/p&gt;

&lt;p&gt;Together, these properties ensure that a SQL database can be used to store and process data reliably and consistently, even in the face of system failures and concurrent access. They are an essential part of any database management system, and are what allow developers to build applications that depend on the integrity and consistency of the data stored in the database.&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>Adding JSON validation to structs in Go lang</title>
      <dc:creator>Sanjay Singh Rajpoot</dc:creator>
      <pubDate>Sat, 31 Dec 2022 16:36:24 +0000</pubDate>
      <link>https://forem.com/sanjaysinghrajpoot/adding-json-validation-to-structs-in-go-lang-4mg8</link>
      <guid>https://forem.com/sanjaysinghrajpoot/adding-json-validation-to-structs-in-go-lang-4mg8</guid>
      <description>&lt;p&gt;In this blog, let's try to implement JSON validation for the data strut that we made. Let's start with the basics&lt;/p&gt;

&lt;h2&gt;
  
  
  What is JSON validation?
&lt;/h2&gt;

&lt;p&gt;JSON validation verifies that the data that is fed into the struct is of the right order and value. This means that you can set rules and regulations for the data that is being placed into the struct object. The function or the library that we can use for this purpose is called JSON Validator. JSON Validator verifies that your JavaScript Object Notation adheres to the JSON specification. JSON Validator verifies that your JavaScript Object Notation adheres to the JSON specification.&lt;/p&gt;

&lt;p&gt;below is an example of JSON validation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type Product struct {
    // the id for the product
    //
    // required: false
    // min: 1
    ID int `json:"id"` // Unique identifier for the product

    // the name for this poduct
    //
    // required: true
    // max length: 255
    Name string `json:"name" validate:"required"`

    // the description for this poduct
    //
    // required: false
    // max length: 10000
    Description string `json:"description"`

    // the price for the product
    //
    // required: true
    // min: 0.01
    Price float32 `json:"price" validate:"required,gt=0"`

    // the SKU for the product
    //
    // required: true
    // pattern: [a-z]+-[a-z]+-[a-z]+
    SKU string `json:"sku" validate:"sku"`
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What is the need for JSON validation?
&lt;/h2&gt;

&lt;p&gt;There are a few reasons why JSON validation is important:&lt;/p&gt;

&lt;p&gt;Data integrity: JSON validation helps ensure that the data in your JSON documents is accurate, complete, and consistent. By validating incoming JSON documents, you can catch errors and prevent invalid data from being processed by your application.&lt;/p&gt;

&lt;p&gt;API consistency: If you're building an API that accepts JSON documents as input, JSON validation can help ensure that your API is consistent and predictable. By defining a schema for your JSON documents and validating incoming documents against that schema, you can ensure that your API receives the correct data and returns the expected results.&lt;/p&gt;

&lt;p&gt;Security: JSON validation can also help improve the security of your application. By ensuring that your JSON documents are properly formatted and contain only valid data, you can prevent attacks such as injection attacks that might exploit vulnerabilities in your application.&lt;/p&gt;

&lt;p&gt;Implementing JSON validation in GoLang&lt;br&gt;
For JSON validation we will make use of a library called &lt;code&gt;Validator v10&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Few Package validator features&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Cross Field and Cross Struct validations by using validation tags or custom validators.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Slice, Array and Map diving, which allows any or all levels of a multidimensional field to be validated.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ability to dive into both map keys and values for validation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Handles type interface by determining it's underlying type prior to validation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Alias validation tags, which allows for mapping of several validations to a single tag for easier defining of validations on structs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;Use go get.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


go get github.com/go-playground/validator/v10
Then import the validator package into your own code.



import "github.com/go-playground/validator/v10"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once that is done let's create a simple struct to accept a few values and assign&lt;/p&gt;

&lt;p&gt;some parameters to it.&lt;/p&gt;

&lt;p&gt;Go&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type User struct {
    ID       int    `json:"id" validate:"required,gt=0"`
    Username string `json:"username" validate:"required,min=3,max=20"`
    Email    string `json:"email" validate:"required,email"`
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we've defined a User struct with three fields: ID, Username, and Email. We've also added validation tags to each field, which specify the validation rules that should be applied to each field.&lt;/p&gt;

&lt;p&gt;For example, the ID field has a required and gt validation tag, which means it must be a required field and must be greater than 0. The Username field has a required and min and max validation tag, which means it must be a required field and must be at least 3 characters long and at most 20 characters long. The Email field has a required and email validation tag, which means it must be a required field and must be a valid email address.&lt;/p&gt;

&lt;p&gt;After this inside the main function create a new object of the Validator class and call its Struct() method. Passing it the JSON string and a pointer to a struct that represents the document. If the validation fails, the function returns an error containing a list of validation errors for each field that failed validation. If the validation succeeds, the function returns nil.&lt;/p&gt;

&lt;p&gt;Entire code&lt;/p&gt;

&lt;p&gt;package main&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
import (
    "fmt"
    "strings"

    "github.com/go-playground/validator/v10"
)

type User struct {
    ID       int    `json:"id" validate:"required,gt=0"`
    Username string `json:"username" validate:"required,min=3,max=20"`
    Email    string `json:"email" validate:"required,email"`
}

func main() {
    jsonStr := `{"id": 1, "username": "user", "email": "user@example.com"}`
    var user User
    validate := validator.New()
    if err := validate.Struct(jsonStr, &amp;amp;user); err != nil {
        errs := err.(validator.ValidationErrors)
        for _, fieldErr := range errs {
            fmt.Printf("field %s: %s\n", fieldErr.Field(), fieldErr.Tag())
        }
        return
    }
    fmt.Println("validation succeeded")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank You for reading!!&lt;/p&gt;

&lt;p&gt;bye :)&lt;br&gt;
type User struct {&lt;br&gt;
    ID       int    &lt;code&gt;json:"id" validate:"required,gt=0"&lt;/code&gt;&lt;br&gt;
    Username string &lt;code&gt;json:"username" validate:"required,min=3,max=20"&lt;/code&gt;&lt;br&gt;
    Email    string &lt;code&gt;json:"email" validate:"required,email"&lt;/code&gt;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;func main() {&lt;br&gt;
    jsonStr := &lt;code&gt;{"id": 1, "username": "user", "email": "user@example.com"}&lt;/code&gt;&lt;br&gt;
    var user User&lt;br&gt;
    validate := validator.New()&lt;br&gt;
    if err := validate.Struct(jsonStr, &amp;amp;user); err != nil {&lt;br&gt;
        errs := err.(validator.ValidationErrors)&lt;br&gt;
        for _, fieldErr := range errs {&lt;br&gt;
            fmt.Printf("field %s: %s\n", fieldErr.Field(), fieldErr.Tag())&lt;br&gt;
        }&lt;br&gt;
        return&lt;br&gt;
    }&lt;br&gt;
    fmt.Println("validation succeeded")&lt;br&gt;
}&lt;br&gt;
Thank You for reading!!&lt;/p&gt;

&lt;p&gt;bye :)&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>MLH prep: My Experience</title>
      <dc:creator>Sanjay Singh Rajpoot</dc:creator>
      <pubDate>Thu, 18 Aug 2022 13:30:00 +0000</pubDate>
      <link>https://forem.com/sanjaysinghrajpoot/mlh-prep-my-experience-2gpj</link>
      <guid>https://forem.com/sanjaysinghrajpoot/mlh-prep-my-experience-2gpj</guid>
      <description>&lt;p&gt;Whoop things moved really fast in the past 3 weeks. For the past 3 weeks, I was working as an MLH prep fellow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wxDmlTU5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u4u1wef9ep8qot2nk5vz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wxDmlTU5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u4u1wef9ep8qot2nk5vz.png" alt="Image description" width="880" height="548"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I got the mail from the MLH team that I was selected for the July prep program, Finally, the day arrived and I got the invitation link to join the first standup meeting. Before this, we were asked to choose the time slot for the stand-up meeting we had two options one was at 7:30 PM IST and another was 11:30 IST. I choose the 11:30 PM IST option as it was more suitable for me.&lt;/p&gt;

&lt;p&gt;I joined with the zoom link provided in the mail. Our pod leader was Alex, we waited for around 5 mins for everyone to join then we started our interaction session. But this was not a regular interaction, our pod leader was assigned different break-out rooms randomly with one other person. Each of us was given a few questions that we had to ask each other so that we introduce the other person to the entire pod. I asked a few basic questions and the same was done by the other person. After a few minutes of chat, we were called back to the main room. I introduced the other to the pod and the same was done by the other team members.&lt;/p&gt;

&lt;p&gt;Once the interaction was over we were assigned a team member with whom we have to work on an issue for the next week. We were given a sample repo that had a portfolio website made with Jekyll.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project 1 — Portfolio website&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zU3BhiKY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ncf3c3hee13ilmji3glz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zU3BhiKY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ncf3c3hee13ilmji3glz.png" alt="Image description" width="880" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It was a portfolio website made with Jekyll, HTML, CSS, and Ruby. For the first week, we all were assigned one issue on which we have to work on for the next week. I and my teammate picked the issue to create a profile card for each of the pod members. For this, we had to learn how does Jekyll work? we divided our work, I was working on creating a new page where all the information about the team member would be taken from a yml file and rendered on the profile page. My team member worked on linking all the profile page cards to the main page. While doing this we ran into a small problem, we didn’t have data about all the other team members. For this, I circulated a google form quickly and saved all the responses to the website’s yml file. Remember we only had 2days to finish this feature that is too with a team that you have meet just 24 hours ago.&lt;/p&gt;

&lt;p&gt;Every day we had a standup in which we had to share our progress for the past 24 hours. We managed to get our PR merged and the feature was working as expected. In our 3rd standup, our pod leader merged all the PR that was made. We later found out that it was a complete mess as no one was working with the latest changes each PR changes some part of the code. So for the remaining days, we worked on fixing the design issue that occurred due to merge conflicts. The entire team was highly active and productive we all used to solve each other's problems and that thing taught me management skills. Finally, the site was ready, check it out!!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pod.js is the name given to our pod. Some key features are&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All the images of our team members are displayed at the top. A little description at the bottom of it.&lt;/li&gt;
&lt;li&gt;Meet the pod section has the names and locations of all the pod members if you click on this a separate profile page will open with more information about the team member.&lt;/li&gt;
&lt;li&gt;A world map with the location of all the team members&lt;/li&gt;
&lt;li&gt;A leader board chats to display all the contributions made by fellow teammates made using Github APIs.&lt;/li&gt;
&lt;li&gt;A lite and dark mode on all the pages.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c_hsijmW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/34yfo8ybjtx3hmkws2jr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c_hsijmW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/34yfo8ybjtx3hmkws2jr.png" alt="Image description" width="880" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project 2 — Weather Application&lt;/strong&gt;&lt;br&gt;
The next project was a weather application. For this also we were given a sample template on which we have to work. This was a 2 weeks long project and our final project will be displayed on graduation day. We were again assigned with a teammate from our pod. I took the issue to add an interactive map to the website. For this, we took the help of a js library called map.js that would render a world map onto the website on hover it would give us latitude and latitude of the location. We then updated the Open Weather API to use coordinates in place names. Once this feature was added I created a new issue to dockerize the entire application and push its image to the docker hub.I had past working experience of using docker so I used it here the application was dockerized and pushed to the docker hub.&lt;/p&gt;

&lt;p&gt;Then I started working with other folks to add a new feature that will display the Air Quality index of the desired location. One of my teammates gave me the API keys that I implemented using Axios to fetch the data and displayed it using a react js form layout. This project had a lot of components to it and whenever a single PR was merged we all started to get some merge conflicts. To fix this issue we have to actively inform each other about the changes we were making so that no two changes overlap with each other and we can update our local repo.&lt;/p&gt;

&lt;p&gt;As I mentioned in the last project we ran into a lot of errors due to merge conflicts. This time we all were given a small task to review at least one from all the PR present. We all reviewed each other's PR and fixed a lot of merge conflicts overall we made 58 PRs and 30 issues in a span of 2 weeks. Finally, the project was complete. Checkout here!!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UfNmMlCc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z731bf79tapnc83uwqyc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UfNmMlCc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z731bf79tapnc83uwqyc.png" alt="Image description" width="880" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2SLxdTZa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jdfc2h24ylcgy4kpxee6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2SLxdTZa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jdfc2h24ylcgy4kpxee6.png" alt="Image description" width="880" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  key features of the Weather App
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Less than 100ms response time on APIs&lt;/li&gt;
&lt;li&gt;Air Quality Index measures the location in real-time&lt;/li&gt;
&lt;li&gt;Things to take at the desired location. A list of products that you can carry with you.&lt;/li&gt;
&lt;li&gt;A 3D and a 2D map to search for places&lt;/li&gt;
&lt;li&gt;7 days weather forecast of a particular location. And data for more days can be accessed with a simple click.
## Conclusion
I am running out of words believe me!! It was one of the best experiences of my life. 12 people from all around the world meet 24 hours ago and start working to pull up this amazing project. I really have no idea how we did this. We all were positive about everything that we did I guess that is one of the reasons that kept us pushing further and further and remember we were not paid to do these things It was all done by our own will. The only thing that we were getting back was learning and experiences. Made some memorable friends and had unforgettable experiences!!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If I talk about numbers then we&lt;/p&gt;

&lt;p&gt;we made 2 projects&lt;br&gt;
we made 58+43 = 101 pull request in total&lt;br&gt;
we made 20+35 = 55 issues in total&lt;br&gt;
Had a titanic amount of learning!!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l8q5klJm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eigdochvvn08jc6essc1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l8q5klJm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eigdochvvn08jc6essc1.png" alt="Image description" width="880" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Teammates: Liuba ▪ Himanshu Thakur ▪ Chidera Innocent ▪ Elmar ▪ Shehab Adel ▪ Somaditya Singh ▪ Vy Nguyen ▪ Indira Sowy ▪ Julian Willis ▪ Di Wu ▪ A.S.L.Manasa ▪ Sadiq Babalola&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Thank you&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What is WebLN? Summer of Bitcoin 2022</title>
      <dc:creator>Sanjay Singh Rajpoot</dc:creator>
      <pubDate>Sun, 07 Aug 2022 10:03:00 +0000</pubDate>
      <link>https://forem.com/sanjaysinghrajpoot/what-is-webln-summer-of-bitcoin-2022-538o</link>
      <guid>https://forem.com/sanjaysinghrajpoot/what-is-webln-summer-of-bitcoin-2022-538o</guid>
      <description>&lt;p&gt;I got selected for the summer of bitcoin under Ride the lighting org. I will be working on implementing the WebLN feature to RTL’s Quick-pay extension. This will involve creating new files for the web ln features. This will enable the Quickpay Browser extension to give a better user experience to the people. Enabling support for WebLN in the Quickpay extension can help improve RTL’s ability to support other apps and browser extensions that may rely on this standard.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is WebLN?
&lt;/h2&gt;

&lt;p&gt;WebLN is a library and set of specifications for lightning apps and client providers to facilitate communication between apps and users’ lightning nodes in a secure way. It provides a programmatic, permissioned interface for letting applications ask users to send payments, generates invoices to receive payments, and much more. This documentation covers both how to use WebLN in your Lightning-driven applications and how to implement a provider.&lt;/p&gt;

&lt;p&gt;Lightning Network is just another software, and we want to integrate it with the web, adding Lightning to web will go a long way. This is precisely the idea behind WebLN, which is a simple JavaScript tool to build Lightning-enabled browser extensions using makePayment and sendInvoice (again, the two core functions for any kind of money: sending and receiving).&lt;/p&gt;

&lt;p&gt;WebLN offers a few advantages. First, JavaScript is nearly universal and almost thirty years old. Second WebLN delivers a better interface for the users, starting with the fact that you don’t need to use a second device. It feels native, not like a workaround. You also have access to all browser events, so a key press, a mouse click, a scroll position, etc. can all trigger a payment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vgdc0Nts--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ma2agoefmtrrf6u8pfrj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vgdc0Nts--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ma2agoefmtrrf6u8pfrj.png" alt="Image description" width="880" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;p&gt;First Way: Install with Package Manager (Preferred)&lt;br&gt;
Install the webln library using your package manager of choice:&lt;/p&gt;

&lt;p&gt;npm: &lt;code&gt;npm install --save webln&lt;/code&gt;&lt;br&gt;
yarn: &lt;code&gt;yarn add webln&lt;/code&gt;&lt;br&gt;
And import it into your project wherever you need it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { requestProvider } from 'webln';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Second Way: Include Script (Alternative)
&lt;/h3&gt;

&lt;p&gt;Alternatively, you can include a script on your page that will load the library. Be sure to keep the integrity check to prevent malicious Javascript from loading.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script
  src="https://unpkg.com/webln@0.2.0/dist/webln.min.js"
  integrity="sha384-mTReBqbhPO7ljQeIoFaD1NYS2KiYMwFJhUNpdwLj+VIuhhjvHQlZ1XpwzAvd93nQ"
  crossorigin="anonymous"
&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the first that we need to do is to enable the WebLN provider in the web browser so that every component inside our website can use all the WebLN features. So in the next step, we will try to implement a WebLN provider with the help of which we will be use all the WebLN features.&lt;/p&gt;

&lt;p&gt;Most of WebLN’s methods will prompt the user in some way, often times to make payments or have them provide the information they may feel is quite private. Before running &lt;code&gt;requestProvider&lt;/code&gt; or other methods, make sure the user knows what your app does, and why they should allow your calls to run. Popping up as soon as they load a page will cause users to reject &lt;code&gt;WebLN&lt;/code&gt; requests, or worse yet, bounce from your page.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;requestProvider&lt;/code&gt;&lt;br&gt;
To begin interacting with a user’s Lightning node, you’ll first need to request a &lt;code&gt;WebLNProvider&lt;/code&gt; from them. &lt;code&gt;WebLNProvider&lt;/code&gt; is a class that various clients implement and attach to your web session. Calling &lt;code&gt;requestProvider&lt;/code&gt; will retrieve the provider for you, and prompt the client for permission to use it. Once you get the provider, you're free to call all of the other API methods.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QttUA1E9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6a9lfjkugu7aushycqxt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QttUA1E9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6a9lfjkugu7aushycqxt.png" alt="Image description" width="880" height="947"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;WebLN getInfo function&lt;br&gt;
Ask the user for some information about their node. The request may be rejected by the user depending on the provider implementation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function getInfo(): Promise&amp;lt;GetInfoResponse&amp;gt;;
Response

interface GetInfoResponse = {
  node: {
    alias: string;
    pubkey: string;
    color?: string;
  };
}
webln.makeInvoice
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is used to create an Invoice for the user by the app. This will return a BOLT-11 invoice. There are many ways to request an invoice they are&lt;/p&gt;

&lt;p&gt;By specifying an explicit amount, the user's provider should enforce that the user generate an invoice with a specific amount&lt;br&gt;
When an explicit amount is not set, the user can return an invoice that has no amount specified, allowing the payment maker to send any amount&lt;br&gt;
By specifying a &lt;code&gt;minimumAmount&lt;/code&gt; and / or &lt;code&gt;maximumAmount&lt;/code&gt;, the user's provider should enforce that the user generate an invoice with an amount field constrained by that amount&lt;br&gt;
Amounts are denominated in &lt;code&gt;satoshis&lt;/code&gt;. For large amounts, it’s recommended you use a big number library such as&lt;code&gt;bn.js&lt;/code&gt;as &lt;code&gt;Javascript&lt;/code&gt; only supports 32 bit integers.&lt;/p&gt;
&lt;h3&gt;
  
  
  Parameters
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function makeInvoice(args: RequestInvoiceArgs): Promise&amp;lt;RequestInvoiceResponse&amp;gt;;

interface RequestInvoiceArgs {
  amount?: string | number;
  defaultAmount?: string | number;
  minimumAmount?: string | number;
  maximumAmount?: string | number;
  defaultMemo?: string;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Response&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;interface RequestInvoiceResponse {
  paymentRequest: string;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What if there is an error?
&lt;/h2&gt;

&lt;p&gt;To handle this test case both apps and providers can make use of WebLN’s pre-defined errors. They can be found in webln/lib/errors and should be used when throwing and handling errors to best inform the user of what's going on:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ey8tdAk1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zjy0mz68a1lfabcnorhf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ey8tdAk1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zjy0mz68a1lfabcnorhf.png" alt="Image description" width="880" height="448"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;WebLN Error&lt;br&gt;
And the provider should throw the correct error when possible:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ouwTqREA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yb5909i436f08prp8yzk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ouwTqREA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yb5909i436f08prp8yzk.png" alt="Image description" width="880" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;WebLN Error Provider&lt;br&gt;
Resources&lt;br&gt;
&lt;a href="https://www.npmjs.com/package/webln"&gt;https://www.npmjs.com/package/webln&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/joule-labs/webln-docs"&gt;https://github.com/joule-labs/webln-docs&lt;/a&gt;&lt;br&gt;
&lt;a href="https://webln.dev/#/api/make-invoice"&gt;https://webln.dev/#/api/make-invoice&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/@wbobeirne/making-a-lightning-web-app-part-4-c0997f4353b8"&gt;https://medium.com/@wbobeirne/making-a-lightning-web-app-part-4-c0997f4353b8&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/joule-labs/webln/issues/13"&gt;https://github.com/joule-labs/webln/issues/13&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>LFX Mid-Evaluation</title>
      <dc:creator>Sanjay Singh Rajpoot</dc:creator>
      <pubDate>Sun, 10 Jul 2022 12:32:39 +0000</pubDate>
      <link>https://forem.com/sanjaysinghrajpoot/lfx-mid-evaluation-31fj</link>
      <guid>https://forem.com/sanjaysinghrajpoot/lfx-mid-evaluation-31fj</guid>
      <description>&lt;p&gt;My LFX mentorship started on 1 June with the Moja Global Organisation. By the end of next week (15 July) will have our first evaluation after this we will receive our first stipend. I have already written one blog for the first week you can find it here.&lt;/p&gt;

&lt;p&gt;So far things are going really great. I am working on the FLINT Cloud project which is used for the continuous deployment of FLINT. The project also aims to simplify the process of installation by supporting a single command or step installation process. Check out this link for more info FLINT.Cloud.&lt;/p&gt;

&lt;p&gt;In LFX mentorship doesn’t follow any list check method to track your progress. In this, if you are learning and moving forward at your own pace then you can easily pass the evaluations. Unlike other open-source programs where you have to complete the work by a given deadline.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Work so far
&lt;/h2&gt;

&lt;p&gt;After first week was over I started working on the two tasks that I was given one of them was to implement&lt;/p&gt;

&lt;p&gt;CI/CD for FLINT.Cloud’s REST API FLINT.Example and REST API GCBM using GitHub Actions and Azure Container Registry.&lt;/p&gt;

&lt;p&gt;For this, I was given Azure login credentials that I have to use to make new container images whenever new code was pushed to the main branch of FLINT. Cloud. To make this work I used Github Actions to create a new file called push-to-azure.yaml. This file will be executed if any new changes are made to the main branch of FLINT cloud. Inside this file, I created new where three major sections&lt;/p&gt;

&lt;p&gt;The first step was to log in via Azure credentials which were given to me earlier. With the help of this Github would know on which Azure Cloud Registry they have to push the changes.&lt;br&gt;
The next step was to build a new docker image with all the latest changes and an updated tag.&lt;br&gt;
At last, we have to push this docker image to the Azure Container Registry.&lt;br&gt;
I made PRs for all the changes mentioned above. I was facing a bug that my mentor fixed which was later pushed to the repo.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/moja-global/FLINT.Cloud/pull/138"&gt;https://github.com/moja-global/FLINT.Cloud/pull/138&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/moja-global/FLINT.Cloud/pull/139"&gt;https://github.com/moja-global/FLINT.Cloud/pull/139&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Integrating Terraform scripts for FLINT.Cloud for Azure and created a production-level deployment for FLINT.Cloud&lt;/p&gt;

&lt;p&gt;This was my next task to implement Terraform Scripts. Most of the work for this part was done by my mentor. I tested the PR on my machine and it was working like a charm.&lt;/p&gt;

&lt;p&gt;After this, I collaborate with my partner Janvi, she was facing some errors in running a Kubernetes instance. I tested her PR on my machine as I was using ubuntu and she was using windows. In all this process I learned how to deploy a docker container to Kubernetes and all the basics of Kubernetes like services pods, LoadBalanceer, Ingress policy, and a lot of StackOverflow :) Once I tested the PR there were a few bugs that Janvi fixed and the PR that she made was running on almost all the systems. So kudos for that!!’&lt;/p&gt;

&lt;p&gt;We had our second meeting with the mentor around the last week of June. We were given small tasks for the upcoming weeks. I was asked to review some PRs for the FLINT-UI and I joined one discussion regarding the creation of new endpoints for GCBM.&lt;/p&gt;

&lt;p&gt;In between, I was reviewing PR for the FLINT-UI. I made some changes to the page which is used to modify the GCBM inputs (PR linked below).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/moja-global/FLINT-UI/pull/326"&gt;https://github.com/moja-global/FLINT-UI/pull/326&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As I mentioned above I started working on creating the new upload endpoints which will add new functionality to the website. We have a Documentation Working Group meeting(DWG), In which we finalized the user flow for the GCBM simulation. I was asked to create new endpoints for the title and upload configuration files separately for all the categories. Through these endpoints, users will be able to upload files separately for each category.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/moja-global/FLINT.Cloud/pull/145"&gt;https://github.com/moja-global/FLINT.Cloud/pull/145&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the next week, I will be working on the FLINT cloud itself few more changes are to be made to make it work properly.&lt;/p&gt;

&lt;h1&gt;
  
  
  Thank You
&lt;/h1&gt;

</description>
    </item>
    <item>
      <title>This is why everyone is using Reactjs</title>
      <dc:creator>Sanjay Singh Rajpoot</dc:creator>
      <pubDate>Sat, 11 Jun 2022 04:26:30 +0000</pubDate>
      <link>https://forem.com/sanjaysinghrajpoot/key-features-that-comes-with-react-js-5fb5</link>
      <guid>https://forem.com/sanjaysinghrajpoot/key-features-that-comes-with-react-js-5fb5</guid>
      <description>&lt;p&gt;React Js is one of the most popular front-end frameworks to use these days.  It is playing an essential role in the front-end ecosystem. &lt;/p&gt;

&lt;p&gt;But what makes it so special?&lt;/p&gt;

&lt;p&gt;here are some key feature that comes with React Js&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Simplicity&lt;br&gt;
ReactJS uses JSX file which makes the application simple and to code as well as understand. We know that ReactJS is a component-based approach which makes the code reusable as your need. This makes it simple to use and learn.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Declarative UI&lt;br&gt;
This feature makes React code more readable and easier to fix bugs. React JS is the best platform to develop UIs that are both exciting and engaging not just for web apps, but mobile apps as well.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enables Building Rich UI&lt;br&gt;
The UI of an app is extremely important nowadays; an app with a great UI that offers an exciting browsing and shopping experience to users definitely has a much better chance of succeeding than one with a poor interface.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;One-way Data Binding: &lt;br&gt;
One-way data binding, the name itself says that it is a one-direction flow. The data in react flows only in one direction i.e. the data is transferred from top to bottom i.e. from parent components to child components. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Virtual DOM&lt;br&gt;
A virtual DOM object is a representation of the original DOM object. It works like a one-way data binding. Whenever any modifications happen in the web application, the entire UI is re-rendered in virtual DOM representation. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;JSX&lt;br&gt;
JSX stands for JavaScript XML. It is a JavaScript syntax extension. Its an XML or HTML like syntax used by ReactJS. This syntax is processed into JavaScript calls of React Framework. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Performance&lt;br&gt;
ReactJS is known to be a great performer. This feature makes it much better than other frameworks out there today. The reason behind this is that it manages a virtual DOM. The DOM is a cross-platform and programming API which deals with HTML, XML or XHTML.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Give it a like if you make it this far!!&lt;/p&gt;

&lt;p&gt;Follow for more web dev insights :)&lt;/p&gt;

&lt;h1&gt;
  
  
  reactjs #javascript #webdevelpoment
&lt;/h1&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
      <category>beginners</category>
    </item>
    <item>
      <title>LFX Mentorship Week 1 Experience</title>
      <dc:creator>Sanjay Singh Rajpoot</dc:creator>
      <pubDate>Sun, 05 Jun 2022 15:20:21 +0000</pubDate>
      <link>https://forem.com/sanjaysinghrajpoot/lfx-mentorship-week-1-experience-j2n</link>
      <guid>https://forem.com/sanjaysinghrajpoot/lfx-mentorship-week-1-experience-j2n</guid>
      <description>&lt;p&gt;hello, I am Sanjay Singh Rajpoot, I am currently a third-year engineering student at IET DAVV Indore. I like to contribute to open source a lot. I have been contributing to open-source for 2 years now. I like to real-world problems rather than solve questions on a coding platform. In this post, I will discuss all the key steps that I have taken so far. Let’s get started.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Riowkgvl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vcuwtvhw5c3nbetk0xc8.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Riowkgvl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vcuwtvhw5c3nbetk0xc8.jpeg" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Moja Global and LFX&lt;/p&gt;

&lt;h2&gt;
  
  
  Application Process
&lt;/h2&gt;

&lt;p&gt;For those who are unaware of LFX let me give you a quick info&lt;/p&gt;

&lt;p&gt;The Linux Foundation Mentorship Program is designed to help developers — many of whom are first-time open source contributors — with necessary skills and resources to learn, experiment, and contribute effectively to open source communities. By participating in a mentorship program, mentees have the opportunity to learn from experienced open source contributors as a segue to get internship and job opportunities upon graduation.&lt;/p&gt;

&lt;p&gt;I applied through the LFX portal. I uploaded my Resume, Cover Letter and Work Eligibility Certificate (a type of NOC). Once all these things are done you just have to wait for the results.&lt;/p&gt;

&lt;p&gt;Now what’s important here is I am contributing to Moja Global for around 6 months now from a small typo to big features I have done them all. So my past contribution became a major reason for my selection without it my application would be viewed like all other applications.&lt;/p&gt;

&lt;p&gt;To increase your chances of getting selected talk to the mentor make some contribution to the community and be active. I will write a detailed post regarding this.&lt;/p&gt;

&lt;h2&gt;
  
  
  Program Timelines
&lt;/h2&gt;

&lt;p&gt;It usually happens three times a year, so you can plan and apply accordingly,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spring Term: March 1st — May 31st&lt;/li&gt;
&lt;li&gt;Summer Term: June 1st — August 31st&lt;/li&gt;
&lt;li&gt;Fall Term: September 1st — Nov 30th&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For more information, you can check the LFX Mentorship documentation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Week 1
&lt;/h2&gt;

&lt;p&gt;After getting the result I was really excited to start my journey as an LFX mentee. As I already mentioned I was already a part of the community for a long time. So for me, things were not that new. The thing that excited me the most was the technologies that I have to use.&lt;/p&gt;

&lt;p&gt;Mostly I will be working on the Infrastructure side of FLINT. Cloud. I will use Terraform, Azure, Github actions, CI/CD, Docker and a lot more. As per the requirement, I have to learn new things and solve new problems.&lt;/p&gt;

&lt;p&gt;For the first week, my mentor gave me some responsibilities like reviewing some PRs making code production ready and a few minor bug fixes. For the next few days, I worked on implementing Lighthouse CI. It is used to calculate the SEO performance of the website along with different standard measures.&lt;/p&gt;

&lt;p&gt;We had a google meet in which our mentor told us about our future goals and gave us a few tips to keep things in the exact direction. I have a partner, and along with her, I will be working on a few problems. So few tasks are team-based and the others are self-based.&lt;/p&gt;

&lt;p&gt;So this was all about it. I am learning, hustling, making things, breaking things and a lot more. However, I am enjoying things the most.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick info about Moja Global
&lt;/h2&gt;

&lt;p&gt;Moja global is a not for profit, collaborative project that brings together a community of experts to develop open-source software that allows users to accurately and affordably estimate greenhouse gas emissions and removals from the AFOLU sector. The project’s members aim to support the widest possible use of credible emissions estimation software.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check out their GitHub repo and thank me later bye :)
&lt;/h2&gt;

</description>
    </item>
    <item>
      <title>Summer Vacation and Coding</title>
      <dc:creator>Sanjay Singh Rajpoot</dc:creator>
      <pubDate>Sat, 28 May 2022 05:07:09 +0000</pubDate>
      <link>https://forem.com/sanjaysinghrajpoot/summer-vacation-and-coding-107h</link>
      <guid>https://forem.com/sanjaysinghrajpoot/summer-vacation-and-coding-107h</guid>
      <description>&lt;p&gt;It's summer time!! &lt;/p&gt;

&lt;p&gt;I hope everyone is done with their exams, and now we have a good long summer break.&lt;/p&gt;

&lt;p&gt;You can do several things this summer break if I have to classify them on a larger scale then we have two different ways DSA and Development. Most of the students will try to work in the Development or DSA domain.&lt;/p&gt;

&lt;p&gt;For this post let's focus on the development side,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;There are different paths that you can take to start your development journey. It's not like DSA where you have a defined set of questions that you can solve.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;let's talk about one of the simplest paths that one can follow for development. Pick a few programming languages for beginners it would be HTML, CSS and Javascript.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;First, try to make a single page application(SPA) it can be related to your interest or you can make your own portfolio website.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now next step would be to create a website where you want to take user feedback. Like in the form of a Login page or some sort of survey website. Again it's up to your how you want to explore the web world. For this, you need a few more technologies my preferences would be PHP and MySQL.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your website is ready but it still looks old, lacks responsiveness and is slow to use. To fix this issue you have to use certain CSS frameworks such TailwindCSS, and Chakra UI along with Frontend frameworks such ReactJS, and Angular.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now, the next step would be to save your form data on a remote database. You can use Postgres (SQL), and MongoDB(NoSQL) databases. To make this happen effect you have to use certain frameworks such as Node js, Django, and React Js.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So now you have made a really good project with the help of different tech stacks. You can put this project in your resume and look for some startups which work on the same tech stack as you did.&lt;/p&gt;

&lt;p&gt;Happy Learning :)&lt;/p&gt;

&lt;h1&gt;
  
  
  summer #webdevelopment #learning #project #html #css
&lt;/h1&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Tricks to create an impressive GitHub repository 🔥🔥</title>
      <dc:creator>Sanjay Singh Rajpoot</dc:creator>
      <pubDate>Mon, 09 May 2022 17:25:43 +0000</pubDate>
      <link>https://forem.com/sanjaysinghrajpoot/tricks-to-create-an-impressive-github-repository-d41</link>
      <guid>https://forem.com/sanjaysinghrajpoot/tricks-to-create-an-impressive-github-repository-d41</guid>
      <description>&lt;p&gt;Here are some of the tricks to create an impressive GitHub repository&lt;/p&gt;

&lt;p&gt;We all have seen the same old repository as every other repository looks the same and feels the same. If you want to attract some attention then here are some simple tricks&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;𝗨𝘀𝗲 𝗗𝗲𝘀𝗰𝗿𝗶𝗽𝘁𝗶𝘃𝗲 𝗖𝗼𝗺𝗺𝗶𝘁 𝗠𝗲𝘀𝘀𝗮𝗴𝗲𝘀
Using descriptive commit messages might look like a chore, but it too helps in taking the appeal of the repository higher. Make sure the commit message is explanatory.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There are various schools of commit message structures, any of which is acceptable. I personally like the following one:&lt;/p&gt;

&lt;p&gt;[optional scope]: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;𝗔𝗱𝗱 𝗘𝗺𝗼𝗷𝗶 𝗮𝗻𝗱 𝗚𝗜𝗙𝘀 𝗶𝗻 𝘁𝗵𝗲 𝗥𝗲𝗮𝗱𝗠𝗲 𝗳𝗶𝗹𝗲
The ReadME file is the first thing that a user sees. The ReadMe is the first thing a visitor sees when they visit the repository, so taking some time to create a polished repository is crucial. It should describe what problem the code solves, how to set it up, and any other relevant information.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Use backticks to highlight the code snippets&lt;/li&gt;
&lt;li&gt;Add some hyperlinks&lt;/li&gt;
&lt;li&gt;Add emojis if required&lt;/li&gt;
&lt;li&gt;Add stat figures like no. of stars, commits, PRs etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;𝗔𝗱𝗱 𝗟𝗶𝗰𝗲𝗻𝘀𝗲
No point denying it, this is the most boring step, but essential for fair use of the repository. Moreover, it also shows up in the info tab, so just get it done with.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To add a License, create a file called LICENSE at the root of the project.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;𝗔𝗱𝗱 𝗧𝗮𝗴𝘀 𝗮𝗻𝗱 𝗼𝗻𝗲 𝗹𝗶𝗻𝗸&lt;br&gt;
Adding tags is the next and most crucial step in this article. It not only makes it easier for GitHub to promote the repository but also makes it look much more professional!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;𝗔𝗱𝗱 𝗗𝗲𝘀𝗰𝗿𝗶𝗽𝘁𝗶𝗼𝗻 (𝘄𝗶𝘁𝗵 𝗘𝗺𝗼𝗷𝗶𝘀 &amp;amp; 𝗟𝗶𝗻𝗸)&lt;br&gt;
This is the lowest hanging fruit in creating an impressive GitHub repository. You can just add a short description of the repository to heighten its appeal. Make sure to throw in some emojis too 😉.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These are some of the most common tricks for the GitHub repository. That's all for today guys, follow for more tips and tricks :)&lt;/p&gt;

&lt;h1&gt;
  
  
  github #project #coding #webdevelopment
&lt;/h1&gt;

</description>
      <category>github</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>HTTP Request Methods - GET Vs POST Vs PUT</title>
      <dc:creator>Sanjay Singh Rajpoot</dc:creator>
      <pubDate>Tue, 26 Apr 2022 05:51:10 +0000</pubDate>
      <link>https://forem.com/sanjaysinghrajpoot/http-reguest-methods-get-vs-post-vs-put-4b5m</link>
      <guid>https://forem.com/sanjaysinghrajpoot/http-reguest-methods-get-vs-post-vs-put-4b5m</guid>
      <description>&lt;h2&gt;
  
  
  What is HTTP?
&lt;/h2&gt;

&lt;p&gt;HTTP is a protocol, or a definite set of rules, for accessing resources on the web. Resources could mean anything from HTML files to data from a database, photos, text, and so on.&lt;/p&gt;

&lt;p&gt;These resources are made available to us via an API and we make requests to these APIs via the HTTP protocol. API stands for application programming interface. It is the mechanism that allows developers to request resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Client-Server Architecture
&lt;/h2&gt;

&lt;p&gt;In order to understand the HTTP methods, it’s important to cover the concept of client/server architecture. This architecture describes how all web applications work and defines the rules for how they communicate.&lt;/p&gt;

&lt;p&gt;A client application is the one that a user is actually interacting with, that's displaying the content. A server application is the one that sends the content, or resource, to your client application. A server application is a program that is running somewhere, listening, and waiting for a request.&lt;/p&gt;

&lt;p&gt;The main reason for this separation is to secure sensitive information. Your entire client application gets downloaded into the browser, and all of the data can be accessed by anyone accessing your web page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why We Need A Server-Client Architecture
&lt;/h2&gt;

&lt;p&gt;Let’s say you were building a weather web app, for example. The weather app that your user is going to interact with is the client application – it has buttons, a search bar, and displays data like city name, current temperature, AQI, and so on.&lt;/p&gt;

&lt;p&gt;This weather app wouldn’t have every city and its weather information coded directly into it. This would make the app bloated and slow, would take forever to research and manually add to a database, and would be a headache to update every single day.&lt;/p&gt;

&lt;h2&gt;
  
  
  HTTP Methods Explained
&lt;/h2&gt;

&lt;p&gt;Now that we know what HTTP is and why it’s used, let’s talk about the different methods we have available to us.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. HTTP GET
&lt;/h2&gt;

&lt;p&gt;Use GET requests to retrieve resource representation/information only – and not modify it in any way. As GET requests do not change the resource’s state, these are said to be safe methods.&lt;/p&gt;

&lt;p&gt;Additionally, GET APIs should be idempotent. Making multiple identical requests must produce the same result every time until another API (POST or PUT) has changed the state of the resource on the server.&lt;/p&gt;

&lt;p&gt;If the Request-URI refers to a data-producing process, it is the produced data that shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process.&lt;/p&gt;

&lt;h3&gt;
  
  
  1.1. GET API Response Codes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;For any given HTTP &lt;code&gt;GET&lt;/code&gt; API, if the resource is found on the server, then it must return HTTP response code &lt;code&gt;200 (OK)&lt;/code&gt; – along with the response body, which is usually either &lt;code&gt;XML&lt;/code&gt; or &lt;code&gt;JSON&lt;/code&gt; content (due to their platform-independent nature).&lt;/li&gt;
&lt;li&gt;In case the resource is NOT found on the server then API must return HTTP response code &lt;code&gt;404&lt;/code&gt; (NOT FOUND).&lt;/li&gt;
&lt;li&gt;Similarly, if it is determined that the &lt;code&gt;GET&lt;/code&gt; request itself is not correctly formed then the server will return the HTTP response code &lt;code&gt;400&lt;/code&gt; (BAD REQUEST).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  1.2. Example URIs
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP GET http://www.appdomain.com/users
HTTP GET http://www.appdomain.com/users?size=20&amp;amp;page=5
HTTP GET http://www.appdomain.com/users/123
HTTP GET http://www.appdomain.com/users/123/address
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. HTTP POST
&lt;/h2&gt;

&lt;p&gt;Use POST APIs to create new subordinate resources, e.g., a file is subordinate to a directory containing it or a row is subordinate to a database table.&lt;/p&gt;

&lt;p&gt;When talking strictly about REST, POST methods are used to create a new resource into the collection of resources.&lt;/p&gt;

&lt;p&gt;Responses to this method are not cacheable unless the response includes appropriate Cache-Control or Expires header fields.&lt;/p&gt;

&lt;p&gt;Please note that POST is neither safe nor idempotent, and invoking two identical POST requests will result in two different resources containing the same information (except resource ids).&lt;/p&gt;

&lt;h3&gt;
  
  
  2.1. POST API Response Codes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Ideally, if a resource has been created on the origin server, the response SHOULD be HTTP response code 201 (Created) and contain an entity that describes the status of the request and refers to the new resource, and a Location header.&lt;/li&gt;
&lt;li&gt;Many times, the action performed by the POST method might not result in a resource that can be identified by a URI. In this case, either HTTP response code 200 (OK) or 204 (No Content) is the appropriate response status.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2.2. Example URIs
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP POST http://www.appdomain.com/users
HTTP POST http://www.appdomain.com/users/123/accounts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. HTTP PUT
&lt;/h2&gt;

&lt;p&gt;Use PUT APIs primarily to update an existing resource (if the resource does not exist, then API may decide to create a new resource or not).&lt;/p&gt;

&lt;p&gt;If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries SHOULD be treated as stale. Responses to PUT method are not cacheable.&lt;/p&gt;

&lt;h3&gt;
  
  
  3.1. PUT API Response Codes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;If a new resource has been created by the PUT API, the origin server MUST inform the user agent via the HTTP response code 201 (Created) response.&lt;/li&gt;
&lt;li&gt;If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate successful completion of the request.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3.2. Example URIs
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP PUT http://www.appdomain.com/users/123
HTTP PUT http://www.appdomain.com/users/123/accounts/456
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. HTTP DELETE
&lt;/h2&gt;

&lt;p&gt;As the name applies, DELETE APIs delete the resources (identified by the Request-URI).&lt;/p&gt;

&lt;p&gt;DELETE operations are idempotent. If you DELETE a resource, it’s removed from the collection of resources.&lt;/p&gt;

&lt;p&gt;Some may argue that it makes the DELETE method non-idempotent. It’s a matter of discussion and personal opinion.&lt;/p&gt;

&lt;p&gt;If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries SHOULD be treated as stale. Responses to this method are not cacheable.&lt;/p&gt;

&lt;h3&gt;
  
  
  4.1. DELETE API Response Codes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A successful response of DELETE requests SHOULD be an HTTP response code 200 (OK) if the response includes an entity describing the status.&lt;/li&gt;
&lt;li&gt;The status should be 202 (Accepted) if the action has been queued.&lt;/li&gt;
&lt;li&gt;The status should be 204 (No Content) if the action has been performed but the response does not include an entity.&lt;/li&gt;
&lt;li&gt;Repeatedly calling DELETE API on that resource will not change the outcome – however, calling DELETE on a resource a second time will return a 404 (NOT FOUND) since it was already removed.
### 4.2. Example URIs
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP DELETE http://www.appdomain.com/users/123
HTTP DELETE http://www.appdomain.com/users/123/accounts/456
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What’s the difference between PUT and POST?
&lt;/h2&gt;

&lt;p&gt;PUT requests are idempotent, meaning that executing the same PUT request will always produce the same result.&lt;/p&gt;

&lt;p&gt;On the other hand, a POST will produce different outcomes. If you execute a POST request multiple times, you'll create a new resource multiple times despite them having the same data being passed in.&lt;/p&gt;

&lt;p&gt;Using a restaurant analogy, POSTing multiple times would create multiple separate orders, whereas multiple PUT requests will update the same existing order.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Go ahead and give yourself a pat on the back because you've learned about web APIs, the HTTP protocol, the client-server architecture – and you've also made your first requests. All the HTTP request where discussed here now try to practically test these methods on your machine :) &lt;/p&gt;

&lt;p&gt;🎺🎸 🎻 !!!Happy Coding!!!🎺🎸 🎻….&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
