<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Pradeep R.R. on Medium]]></title>
        <description><![CDATA[Stories by Pradeep R.R. on Medium]]></description>
        <link>https://medium.com/@pradeep.tcrr?source=rss-75b70112844b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8AQziCjGivy3YIhjBivm3A.jpeg</url>
            <title>Stories by Pradeep R.R. on Medium</title>
            <link>https://medium.com/@pradeep.tcrr?source=rss-75b70112844b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 03:30:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pradeep.tcrr/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[NESTJs Controller]]></title>
            <link>https://medium.com/yavar/nestjs-controller-ee610bb5272e?source=rss-75b70112844b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee610bb5272e</guid>
            <category><![CDATA[prisma]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[nestjs-tutorial]]></category>
            <category><![CDATA[nestjs]]></category>
            <dc:creator><![CDATA[Pradeep R.R.]]></dc:creator>
            <pubDate>Sun, 30 Oct 2022 17:51:03 GMT</pubDate>
            <atom:updated>2022-10-31T02:25:25.907Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*G0RUcAMHvyQ_RZNX0_-N-Q.png" /></figure><p>In this blog we will discuss about the controller part in nestjs</p><p>Controllers are responsible for handling request sent to the server ad returning response to the client.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*XFkCHU79IhtScz7vRIRvTw.png" /></figure><p>A controllers is to receive specific request for the application.the routing is a mechanism to controls which controller receives request.</p><p>Each controller has more than one route and different routes have different actions.</p><p>To generate the controller we use ,</p><pre>nest g controller name</pre><p>Routing</p><p>we use the `@controller()` decorator it is basic controller to define an endpoints.</p><pre>import { Controller, Get } from &#39;@nestjs/common&#39;;<br>@Controller(&#39;sample&#39;)<br>export class SampleController {<br> @Get()<br> findAll():string{<br>  return &#39;Hello World&#39;;<br> }<br>}</pre><p>The Get() Http request method decorator.the route path for a handler is detemined by concatenating the prefix declared for the controller.</p><p>The request object represents the HTTP request and has propertis for the request query string,parameters,Http headers,and body.</p><pre>@Request,@Req()             req<br>@Response(),@res()          res<br>@Next()                     next<br>@Session()                  req.session<br>@Param(key?: string)        req.params/req.params[key]<br>@Body(key?: string)         req.body/req.body[key]<br>@Query(key?: string)        req.query/req.query[key]<br>@Headers(name?: string)     req.headers/req.headers[name]<br>@Ip()                       req.ip<br>@HostParam()                req.hosts</pre><p>Route parameters:</p><p>Routes with static path won’t work when you need to accept the dynamic data as part of the request.eg(GET/sample/1-toget sample with id 1).</p><p>`@Param()` is used to decorate a method parameter.we an access the id parameter by referencig params.id.</p><pre>@Get(&#39;:id&#39;)<br>findOne(@Param(&#39;id&#39;) id: string): string {<br>  return `This action returns a #${id} cat`;<br>}</pre><p>Request Payloads:</p><p>The post route handler didn’t accept any client params.let fix by this adding `@Body()` decorator used.</p><p>DTO schema- (data transfer object)</p><p>DTO schema is used to determine by using typescript interfaces and classes.</p><p>``createsampledto`` class</p><pre>export class CreateCatDto {<br>  name: string;<br>  age: number;<br>  breed: string;<br>}</pre><p>It has three basic properties we can use the newly created DTO inside,</p><pre>@Post()<br>async create(@Body() createCatDto: CreateCatDto) {<br>  return &#39;Hello world&#39;;<br>}</pre><p>Library specific approach</p><p>The second way of manipulating response is to use a specific response object.The ``@Res() decorator`</p><pre>import { Controller, Get, Post, Res, HttpStatus } from &#39;@nestjs/common&#39;;<br>import { Response } from &#39;express&#39;;<br><br>@Controller(&#39;sample&#39;)<br>export class SampleController {<br>  @Post()<br>  create(@Res() res: Response) {<br>    res.status(HttpStatus.CREATED).send();<br>  }<br><br>  @Get()<br>  findAll(@Res() res: Response) {<br>     res.status(HttpStatus.OK).json([]);<br>  }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee610bb5272e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/nestjs-controller-ee610bb5272e">NESTJs Controller</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nestjs Initial setup]]></title>
            <link>https://medium.com/yavar/nestjs-initial-setup-506bd166bd0?source=rss-75b70112844b------2</link>
            <guid isPermaLink="false">https://medium.com/p/506bd166bd0</guid>
            <category><![CDATA[fastify]]></category>
            <category><![CDATA[prisma]]></category>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[express]]></category>
            <dc:creator><![CDATA[Pradeep R.R.]]></dc:creator>
            <pubDate>Tue, 27 Sep 2022 17:00:15 GMT</pubDate>
            <atom:updated>2022-10-02T16:23:41.300Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*L1rSd6IHyrfLrtxYa9OYsg.png" /></figure><p>Nestjs is a server side nodejs framework for building efficient and reliable.It provides backend application a modular structure for organizing code into seperate modules.</p><p>First we initialize the project,</p><pre>npm i -g @nestjs/cli</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z667SmC0wrG1BuCUY1IC9g.png" /></figure><pre>$nest new projectname</pre><p>Our project Structure look like this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*IQ9QmKxohIAA1qLkitk6-w.png" /></figure><p>It is inspired from angular.It was built with typescript and expressjs,which makes it compatible with the majority of express middlware.</p><p>The most important folder of the project is the src folder.Inside the src folder you can find five files in the project setup,</p><ul><li>main.ts:Entry point of application.By using the NestFactory.create() method a new Nest application instance is created.</li><li>app.module.ts: contains the implementation of the application’s root module.</li><li>app.controller.ts: Contains the implementation of a basic NestJs Controller with just one route</li><li>app.service.ts: contains basic service implementation.</li><li>app.controller.spec.ts: Testing file for controller</li></ul><p>It has the three blocks of building application</p><ul><li>Controllers</li><li>Providers</li><li>Modules</li></ul><p>Controllers</p><p>They are responsible for handling any request and returning responses to the client side of the application.if you make an API call to a particular endpoint.the controllers will receive request and returned the response.nestjs is mostly used in decorators to handle any request.</p><p>Once a controller is created,It can be added to the module nestjs can easily recognize it.</p><p>To generate a controller we use,</p><pre>$nest g controller</pre><pre>//The controller folder looks like this,</pre><pre>import { Controller, Get } from &#39;@nestjs/common&#39;;<br>import { AppService } from &#39;./app.service&#39;;<br><br>@Controller()<br>export class AppController {<br>  constructor(private readonly appService: AppService) {}<br><br>  @Get()<br>  getHello(): string {<br>    return this.appService.getHello();<br>  }<br>}</pre><p>this method handles a HTTP GET request the @Get decorator is addedto this method.the method is using the getHello method from appservice to retrieve data and at the same time return that data as response.</p><p>Modules</p><p>The Root application module which you can find inside the app.module.ts</p><pre>$nest g module </pre><pre>//The module folder looks like this,</pre><pre>import { Module } from &#39;@nestjs/common&#39;;<br>import { AppController } from &#39;./app.controller&#39;;<br>import { AppService } from &#39;./app.service&#39;;<br><br>@Module({<br>  imports: [],<br>  controllers: [AppController],<br>  providers: [AppService],<br>})<br>export class AppModule {}</pre><p>the object properties is passed into the @Module decorator.the three properties are:</p><ul><li>imports</li><li>controllers</li><li>providers</li></ul><p>Services</p><p>the app.service.ts,</p><pre>nest g service</pre><pre>import { Injectable } from &#39;@nestjs/common&#39;;<br><br>@Injectable()<br>export class AppService {<br>  getHello(): string {<br>    return &#39;Hello World!&#39;;<br>  }<br>}</pre><p>Running the application,</p><p>To start the server you give the command,</p><pre>$npm run start:dev</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*gZQvFEke0r4tyRRGVDNqyA.png" /></figure><p>Thank you for reading …:)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=506bd166bd0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/nestjs-initial-setup-506bd166bd0">Nestjs Initial setup</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTP response status code]]></title>
            <link>https://medium.com/yavar/http-response-status-code-c2b4827f6a68?source=rss-75b70112844b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2b4827f6a68</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[express]]></category>
            <category><![CDATA[js]]></category>
            <category><![CDATA[fastify]]></category>
            <dc:creator><![CDATA[Pradeep R.R.]]></dc:creator>
            <pubDate>Tue, 30 Aug 2022 10:28:55 GMT</pubDate>
            <atom:updated>2022-08-31T18:14:59.091Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qQr806l1TVcbe2DRL_A_Gg.png" /></figure><p>Hi! friends I share my knowledge about HTTP status code.</p><p>HTTP status code are response code that is returned by web servers along with responses indicating whether a request sent by the client was processed to get the result is successfully or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*bHh18RXl0G7ezTSYPwJLxA.jpeg" /></figure><p>There are group of five class of status code available,</p><ol><li>Informational response(1xx)</li><li>Successful response(2xx)</li><li>Redirection response(3xx)</li><li>Client error response(4xx)</li><li>Server error response(5xx)</li></ol><p><strong>(1xx) Informational response</strong></p><p><strong>100 continue</strong></p><p>Only a part of the request has been received by the server, but as long as it has not been rejected, the client should continue with the request.</p><p><strong>101 Switching protocols</strong></p><p>The request has asked the server to switch the protocol.</p><p><strong>102 Processing</strong></p><p>The request from the client to the server that may contain multiple of sub request that takes a longtime to process it .the server received the request and is processing the request and the final response cannot received yet.</p><p><strong>(2xx) Successfull</strong></p><p><strong>200 Ok</strong></p><p>The request has succeeded the response can sent the method.The meaning of http status code 200 is http request method.</p><p>1.GET : The resource has been fetched and is transmitted in the message body.</p><p>2.PUT :The representation of status action</p><p>3.POST :The resource describing the result of the action is transmitted in the message body</p><p>4.TRACE: The message body contains the request message as received by the server.</p><p><strong>201 Created</strong></p><p>The request has been fulfilled and the new resource is created.</p><p><strong>202 Accepted</strong></p><p>The request is accepted for processing and the response is not completed.</p><p><strong>203 Non Authorative information</strong></p><p>The request has been successfully processed, but is returning information that may be from another source</p><p><strong>204 no content</strong></p><p><strong>205 Reset Content</strong></p><p><strong>(4xx) ClientError</strong></p><p><strong>400 Bad request</strong></p><p>The 400 (Bad Request) status code indicates that the server cannot or<br>will not process the request due to something that is perceived to be<br>a client error (e.g., malformed request syntax, invalid request<br>message framing, or deceptive request routing).</p><p><strong>401 Unauthorized</strong></p><p>The request needs the username and password.</p><p><strong>403 Forbidden</strong></p><p>The request was a legal request, but the server is refusing to respond to it</p><p><strong>404 Not Found</strong></p><p>The server cannot find the requested page.</p><p><strong>405 method not allowed</strong></p><p>status code indicates that the method received in the request-line is known by the origin server but not supported by the target resource.</p><p><strong>(5xx) Server Error response</strong></p><p><strong>500 Internal server error</strong></p><p>The server has encountered the situation but it doesn’t know how to handle it.</p><p><strong>502 Bad Gateway</strong></p><p>The 502 (Bad Gateway) status code indicates that the server, while<br>acting as a gateway or proxy, received an invalid response from an<br>inbound server it accessed while attempting to fulfill the request.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2b4827f6a68" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/http-response-status-code-c2b4827f6a68">HTTP response status code</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic PostgreSQL Commands]]></title>
            <link>https://medium.com/yavar/basic-postgresql-commands-5b8ef6044075?source=rss-75b70112844b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b8ef6044075</guid>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[postgresql]]></category>
            <dc:creator><![CDATA[Pradeep R.R.]]></dc:creator>
            <pubDate>Thu, 28 Jul 2022 19:56:33 GMT</pubDate>
            <atom:updated>2022-07-29T05:11:37.806Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*ibQvIOKK6mGDxhrIDNwsHA.png" /></figure><p>Hi Friends,In this blog You’ll get learn basic commands about postgreSQL,</p><p>PostgreSQL is open source,powerful,object relational database.If you don’t have a postgreSQL in your terminal,Follow a basic commands to install postgreSQL.</p><p><strong>Step 1:ADD PostgreSQL REPOSITORY</strong></p><p>To install the repository,you first need to add in your system</p><pre>$sudo apt-get install wget ca-certificates</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*M6_1z6sgz8wgSYOJDy08Wg.png" /></figure><pre>$wget --quiet -O - <a href="https://www.postgresql.org/media/keys/ACCC4CF8.asc">https://www.postgresql.org/media/keys/ACCC4CF8.asc</a> | sudo apt-key add -</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mog32yyclnOxmtoNHmq38Q.png" /></figure><pre>sudo sh -c &#39;echo &quot;deb <a href="http://apt.postgresql.org/pub/repos/apt">http://apt.postgresql.org/pub/repos/apt</a> $(lsb_release -cs)-pgdg main&quot; &gt; /etc/apt/sources.list.d/pgdg.list&#39;</pre><p><strong>Step 2: Update the package list</strong></p><p>To install postgres latest package we use these commands,</p><pre>$sudo apt-get update</pre><p><strong>Step 3: Install PostgreSQl</strong></p><p>To install postgres and the contrib package we use the following command</p><pre>$sudo apt-get install postgresql postgresql-contrib</pre><p><strong>Step 4: check the postgreSQL version we use the following command</strong></p><pre>$apt show postgresql</pre><p><strong>Connect to PostgreSQL in the terminal we use the following command</strong></p><pre>$sudo su - postgres</pre><p>Now, open a postgres prompt using the following command,</p><pre>$psql</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nFJo7KHsoDW-frUjKXXTgQ.png" /></figure><p><strong>Create database name</strong></p><pre># create database test;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*Z6zogfhsdMe7Xplb_ibpGA.png" /></figure><p><strong>Display all database</strong></p><pre># \l</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*zGstVVGAXvC44yOQ8pER4Q.png" /></figure><p><strong>Dangerous command -delete database</strong></p><pre>#drop database databasename;</pre><p><strong>Connect to database</strong></p><pre># \c test</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*gLc7hBz43gDkLa5VTPDbqA.png" /></figure><p><strong>Create a table with constraints</strong></p><pre># create table person(<br>(# id BIGSERIAL NOT NULL PRIMARY KEY,<br>(# first_name VARCHAR(50) NOT NULL,<br>(# last_name VARCHAR(50) NOT NULL,<br>(# gender VARCHAR(8) NOT NULL,<br>(# date_of_birth DATE NOT NULL,<br>(# email VARCHAR(150));</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*fhXO04ZkIFwJPog5MEJBBw.png" /></figure><p><strong>Insert a value in the table</strong></p><pre>insert into person(id,first_name,last_name,gender,date_of_birth,email)values(<a href="/service/mailto:1,&#39;Raja&#39;,&#39;sekar&#39;,&#39;Male&#39;,DATE&#39;21-06-1998&#39;,&#39;raja@gmail.com">1,&#39;Raja&#39;,&#39;sekar&#39;,&#39;Male&#39;,DATE&#39;21-06-1998&#39;,&#39;raja@gmail.com</a>&#39;);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1LSmLEOe9I5YqoTCP5vRyw.png" /></figure><p><strong>To view the table</strong></p><pre># select * from person;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*730YWDdDvbgZqQaeOgVpqw.png" /></figure><p><strong>Orderby</strong></p><pre># select * from person order by id ASC;<br># select * from person order by id DESC;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*BoLQy7zGJhbi1KAgm2Ry0A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*HrzQZXKrrOd90BlD_XW7bQ.png" /></figure><p><strong>Distinct</strong></p><pre># select first_name from person;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/1*rkwWLnNsAsYAAHwFPPT2ZQ.png" /></figure><p><strong>Limit</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*Q3iSnemiRUAdd5mU6aQcnQ.png" /></figure><p><strong>WHERE</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*-b3sWnkCxcXl7kX_3ITLgA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*SUliurbpfGZgBraizv5hEg.png" /></figure><p><strong>Like</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*RscyxnjCbbrth3E7Dufu8g.png" /></figure><p><strong>NOT LIKE</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*b-W_Pbr0Eme7jYx3RBi-Zw.png" /></figure><p><strong>Rename a column name</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*weUYrKVGGZp5Uvr2By4I3Q.png" /></figure><p><strong>Delete rows in a table</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*i1uhxrmjwlYCC9iItnmm6A.png" /></figure><p><strong>Drop table</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*zN-yktx7Bk4xBiBRSuL7eg.png" /></figure><p><strong>Conclusion</strong></p><p>I hope this post helps you to learn the basic postgresql commands for your needs.Thank you for reading friends.</p><p>Reference link:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fqw--VYLpxG4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dqw--VYLpxG4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fqw--VYLpxG4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4e6aa981e4385ae1a83e8c9511e4b3d/href">https://medium.com/media/d4e6aa981e4385ae1a83e8c9511e4b3d/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b8ef6044075" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/basic-postgresql-commands-5b8ef6044075">Basic PostgreSQL Commands</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>