JWT & CRUD Operations

Sadia Mahamuda
3 min readDec 23, 2021

--

Backend Topics:

1. JWT:
Before understanding the JWT we have to be familiar with ‘Authentication’ and ‘Authorization’.

Authentication and authorization are used in security issues. To avoid any unfortunate security issues, we need to ensure an authentication and authorization system in our application. Particularly when a user gets access to a system.

In our daily life we ensure these two things every time. For example: when we use our Gmail account or Facebook account first we have to give credentials. That means authentication required here. Then when we can’t see another user’s personal profile info that he/she secured only for him/her, that’s called the authorization. That means it doesn’t give me any access to it.

Privileging all those accessible for every user, JWT helps the easiest way for a developer/programmer. JWT means JSON Web Tokens. JWT refers to a compact and self-contained method for communicating information as a JSON object between two parties. Because it is signed, this information can be checked and trusted.

  • JSON Web Tokens can be signed using a shared secret and also by using a public/private key pair.
  • Easier to work with JWT as JSON parsers for all programmers.

2. CRUD Operations:

In Computer programming, CRUD stands for Create, Read, Update and Delete. We know most applications have some form of CRUD functionality. In fact, every programmer has had to deal with CRUD operations in various projects.
So, CRUD application is one that allows the form to retrieve and return data from a database.

Create: When an application runs and a client/user starts that application then the user has to register first. For registration or any other case, users must have to submit a form. And when a user fills-up the form and submits it, then its data is stored in the database. That means the user creates some data.

Figure-1: Submission form to create data into database

Figure-2: Nodejs with Mongo Db (request for creating data)

Read: All the data in a web interface that we can see that means we read data that comes from a database.

Figure-3: Read data from database

Update: In our application, we need to modify our data. In CRUD operations execute an UPDATE statement on the table based on the specified primary key for a record within the WHERE clause of the statement. Deletes a specified row in the WHERE clause.

Figure-4: Code for update the status

Delete: Deletes a specified row in the WHERE clause. We need to delete some or specific unnecessary data from our application.

Figure-5: Code for delete a data by ID

--

--