<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Enrico Tia</title>
    <description>The latest articles on DEV Community by Enrico Tia (@enrico_tia_ce7ed068def147).</description>
    <link>https://dev.to/enrico_tia_ce7ed068def147</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3781943%2Fc09f3196-697b-487e-9069-7383ea0c7ac7.png</url>
      <title>DEV Community: Enrico Tia</title>
      <link>https://dev.to/enrico_tia_ce7ed068def147</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/enrico_tia_ce7ed068def147"/>
    <language>en</language>
    <item>
      <title>I Let AI Code a CV Creator App. It Drained Me.</title>
      <dc:creator>Enrico Tia</dc:creator>
      <pubDate>Sat, 17 Oct 2026 01:19:35 +0000</pubDate>
      <link>https://dev.to/enrico_tia_ce7ed068def147/i-let-ai-code-a-cv-creator-app-it-drained-me-500a</link>
      <guid>https://dev.to/enrico_tia_ce7ed068def147/i-let-ai-code-a-cv-creator-app-it-drained-me-500a</guid>
      <description>&lt;p&gt;Yes. You heard that right. This is my shameful confession.&lt;/p&gt;

&lt;p&gt;I am a student of the University of the Philippines Mindanao, currently in my second year taking up a Bachelor's in Computer Science, yet I have committed the one mortal sin every developer avoids: &lt;strong&gt;letting AI do all the work&lt;/strong&gt;. I lost all motivation to continue working on that project, all because the slop the AI generated for me. I also lost some braincells trying to process what is really going on with the entire system of the project, and leave it all to the AI to fix it. This is me suffering all of the consequences of relying on AI slop. &lt;/p&gt;

&lt;p&gt;Before you would shame me for being too overreliant in using AI for my code or a lazy ass, let me actually tell you a story on what really how I got into trouble trying to build what should have been a great app for my own portfolio. Brace yourself, this article will contain a lot of yapping and ranting about my struggles with this experience (I am being blunt about this). Read at your own discretion.&lt;/p&gt;

&lt;h3&gt;
  
  
  May 16, 2026: Build with AI meetup.
&lt;/h3&gt;

&lt;p&gt;On that day I attended a meetup about building with AI by the Google Developers Group in Davao where I actually networked with one of my schoolmates. He shared some of his tips and tricks on how to build software or something else rapidly. These would include the concepts of agent-based development, where you let AI agents assist you in building the codebase, and spec-driven development, where the AI would be operating based on a series of specifications provided by the user, or truth grounds on what to build, alongside a todo list (IBM, 2026). He also introduced me how the Gemini CLI works and how he is building rapidly with it. That thing is very generous with its rate limits (credits reset every 5 hours; if limit exceeded, resets in 1 week), and it really got me excited because I got this delusion that I can build anything I want with AI, so long as I can prompt properly and decide which to keep, modify or delete. So I wanted to actually give it a shot to develop a solo project.&lt;/p&gt;

&lt;h3&gt;
  
  
  June - August 2026: The &lt;del&gt;Grind&lt;/del&gt; Struggle.
&lt;/h3&gt;

&lt;p&gt;Because I was busy with school and hackathon stuff, that solo project had to start late. And to my surprise, the Gemini CLI has already reached its end of support and got replaced with Antigravity that had less generous rate limits where credits reset weekly instead of the usual 5 hour reset (this was actually the pro plan but I ain't gonna pay for AI). I didn't really want to use Claude that much because it is expensive and credits would deplete swiftly once I prompt it. Nevertheless, I started building my project with writing a spec. To do that I needed the help of Claude to write the initial project specifications (this is the only one of the two times I used Claude to code my project). &lt;/p&gt;

&lt;p&gt;&lt;em&gt;"Hello Claude! I want to create a cv resume creation app where the user would just fill out his personal details such as location, gmail, contact number, linkedin, and GitHub, and list his experiences, education, awards, projects, skills and characteristics, certifications, and research publications. I want the website to allow the user to add any of the sections to the cv with just a click of buttons. When he is done, the website should make a LaTeX file containing the info he placed in the website (Note that there is a Python script to be able to convert those info). Can you make me a SPECS.md and a TODO.md file containing the frontend and backend guides on building the app? I prefer that the backend should be using REST API and via Node.js and PostgreSQL as the database and that the frontend should be using react."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(Can you see what is wrong with this prompt?)&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  But what exactly was I planning to build?
&lt;/h4&gt;

&lt;p&gt;I was planning to build a LaTeX CV creator app. Basically what this does is that the user would first fill out his personal details, then fill out the other sections. This is done through through the click of the add button of one section. &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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Filiml5g35ykdyxorjksx.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Filiml5g35ykdyxorjksx.png" alt="UI Mockup of the project generated by Moonchild AI" width="800" height="517"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;UI Mockup of the project generated by Moonchild AI&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;What this tries to solve is basically the fact that each one of us has a preferred order on which information to present in the CV. The only limitation is that it is more compatible for CS or similar degrees.&lt;/p&gt;

&lt;p&gt;After filling up the fields, the website would basically fetch what was filled up, parsed into a LaTeX file, then pipelined into a pdf. The website also provides a preview of the PDF. The PDF would look something like this:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo1vt2of4240td2dcclsw.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo1vt2of4240td2dcclsw.png" alt="Expected pdf output of website" width="557" height="485"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Expected pdf output of website&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Furthermore, the app was designed to be completely free, and it was planned to be advertised this way. I didn't really want to use any AWS services because I wanted the app to be completely free for both the client and myself, the developer. I do not want to bombard my clients with ads just to gain revenue on user interactions, nor do I want to get charged unexpectedly for several requests from clients.&lt;/p&gt;
&lt;h4&gt;
  
  
  Planning and Designing Phase
&lt;/h4&gt;

&lt;p&gt;Before I actually begin building with AI, I had to refine the specs and the requirements of the project. It took a lot of thinking and tweaks need to finalize the spec document because once I start feeding the AI the specs, there is no turning back. I did not want to end up with a project that is too generic, so I needed to add new features to the specs.&lt;/p&gt;

&lt;p&gt;The mockup you saw above was actually AI generated. Here is my prompt:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"Design a pc/mobile website for a cv resume creation app where the user would just fill out his personal details such as location, gmail, contact number, linkedIn, and GitHub, and list his experiences, education, awards, projects, skills and characteristics, certifications, and research publications through the click of buttons and generates a pdf file once submitted. The experience should feel fast, easy, and trustworthy so that the user can focus entirely on their content. Keep the UI clean, simple, and easy to understand.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For the colors, I want the background to be pure white with light gray divider borders, the structure to be a jet black color (#1A202C) for high contrast text layout, and electric indigo (#4F46E5) as used only for currently active input fields and primary completion buttons.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Please do not make the cv creation process sequential where the user has to fill out each section individually. I want it something like this:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;A **sidebar or top toolbar&lt;/em&gt;* lists all possible sections.*&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Sections not yet added show an *&lt;/em&gt;"Add Section" button*&lt;em&gt;.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Added sections appear in the main builder area as collapsible cards.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Each section card has:&lt;/em&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Collapse/expand toggle&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Delete section button&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Drag-to-reorder handle (optional v2)&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Repeatable sections (Experience, Education, etc.) have an *&lt;/em&gt;"Add Entry"** button that appends a new blank entry form.*
"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pay attention on how I structured my prompts as it will be important as this blog progresses. I gave the AI the context it needs, the instructions, and the constraints, including the tone. The output above shows some promise. So I had high hopes that I would be able to pull this project off.&lt;/p&gt;

&lt;p&gt;But like what I said, I was met with a challenge of limited credit usage. Sometimes I would use Antigravity, but these burn a lot of credits whenever I prompt something, so I only used that to refine my specs and todo documents. I mainly used GitHub Copilot to build the project and if the credits for the month reached the limit, I switch to AWS Kiro to do the work for me.&lt;/p&gt;
&lt;h4&gt;
  
  
  Building the backend
&lt;/h4&gt;

&lt;p&gt;The &lt;del&gt;grind&lt;/del&gt; struggle officially starts, as I would start to build the backend of the project. But let's just say my relationship with the AI is not going so well. Here is a sample prompt to GHCopilot:&lt;/p&gt;

&lt;p&gt;"&lt;br&gt;
&lt;em&gt;Read SPECS.md and TODO.md. Can you help me implement the export endpoints of the app (POST &lt;code&gt;/api/cv/export&lt;/code&gt; and POST &lt;code&gt;/api/cv/:id/export&lt;/code&gt;)? I believe that the latex generation script (&lt;code&gt;server/python/generate_latex.py&lt;/code&gt;) and the latex pdf service (&lt;code&gt;src/services/latex.service.js&lt;/code&gt;) have already been implemented, but please feel free to refine it if you want. Ensure that everything works and that no security considerations are violated and no protected public code would be mirrored verbatim. If there are errors that may happen during the check, please fix them. If there are missing files, please add them to ensure that the app is ready for the next phases. Once done, please check the boxes of TODO.md to mark that task as done.&lt;/em&gt;&lt;br&gt;
"&lt;br&gt;
&lt;em&gt;(Can you see what is wrong with this prompt?)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I am trying my best to prompt to the AI but I am being pressured by time. I really wanted to finish the project by the end of our summer break, but because I can only use free models and I only have limited credits, I had to make the most out of it. But then the code it generated for the backend was so garbage. One time we were having an affair over an error like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;Status:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;Response:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"statusCode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;ERROR: No token returned from register (cannot connect to database)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It even got to the point where GHCopilot blocked my prompt because it is starting to match protected public code verbatim. The above prompt you read was actually a response to GHCopilot blocking my previous prompt, and what is frustrating is that 15% of my monthly credits were gone to waste. I was like "I already elaborated my prompt. Is that not enough? What more do you want from me?" At this point, the more I keep going forward with letting AI do all the work, the more annoying it gets when it just never fails to disappoint giving me slop after slop. But my stubborn ass still wanted me to keep going. After all, it was almost the end of July when I was struggling, so the credits will reset for the August season.&lt;/p&gt;

&lt;h4&gt;
  
  
  Building the frontend
&lt;/h4&gt;

&lt;p&gt;After all was settled and I became okay with how the API endpoints were finally "working", it was finally time that I proceed to building the frontend. I prioritized building the form builder page since the landing page would be easy to vibe code once the form builder page is fully functional. But knowing me, I let the AI cook everything for me given that I let it look at the UI mockup and the specs and todo documents for it context, and this is the dish it cooked for me.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fviom17getbl5m13v46a4.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fviom17getbl5m13v46a4.png" alt="Initial output of the AI (GitHub Copilot; slop)" width="799" height="365"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Initial output of the AI (GitHub Copilot; slop)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Name at least one thing that went wrong with this page before scrolling down to read further.&lt;/p&gt;

&lt;p&gt;.&lt;br&gt;
.&lt;br&gt;
.&lt;/p&gt;

&lt;p&gt;If you identified that the sidebar and the PDF preview section scrolls alongside the main contents of the page, then you are an absolute legend. &lt;/p&gt;

&lt;p&gt;I didn't even expect that the AI would place the PDF preview section there, but I didn't really mind it since it is a nice way for the user to check the progress of their work in their laptops, but still, the UI kind of sucked and it didn't even match what was expected (the UI mockup). Even if the database or backend seems to be "working fine", trying to connect it with the frontend would be a nightmare for the AI. I mean look at the Invalid CV Payload error in the UI, it is not properly documented nor is it explained properly. And great, I was out of credits for GitHub Copilot, and since I don't want to pay for a better AI plan (why would I do that; that would be kind of cheating like how I view p2w players haha) nor use my Claude credits (that is way too expensive), I switched to AWS Kiro to continue development.&lt;/p&gt;

&lt;p&gt;My experience with AWS Kiro is much more smoother than the one in GitHub Copilot. The approaches of Kiro are much more direct than that of GHCopilot's as it would always follow its Easy Approach to Requirements Syntax framework. It got me thinking that I should have used Kiro instead of GHCopilot's AIs from the very beginning. It has a structure where it also runs tests to ensure that you really get what you want. It even fixed the issues with the database schema and the invalid payload errors. The only problem is that it has limited credits so it is only a matter of days until I cannot work unless I pay for a pro plan (you know where this is going).&lt;/p&gt;

&lt;p&gt;Anyways, I became more cautious about what to prompt, learning from my previous mistakes so here is the prompt that I used to revamp the appearance of the UI.&lt;/p&gt;

&lt;p&gt;"&lt;br&gt;
&lt;em&gt;You are a frontend systems designer. The current builder page of my website needs a lot of revamps as the UI is too generic. Here are the following specifications that needs to be integrated in the website.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;1. Let's switch to light mode instead of dark mode. I want the user to be more focused and immersed on creating their own CVs. DO NOT ADD AN OPTION TO REVERT BACK TO DARK MODE.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;2. Let's change the font to something else because it looks too generic. Instead of the boring apple fonts displayed in the website, please replace them with "Playfair Display (weight 400)" as the headings, "PT Serif" as the subheadings, and "Plus Jakarta Sans" as normal text (weight 400) and UI controls or buttons (weight 700). You may get these fonts from Google Fonts.&lt;/em&gt; &lt;br&gt;
&lt;em&gt;(&lt;a href="https://fonts.googleapis.com/css?family=Playfair+Display" rel="noopener noreferrer"&gt;https://fonts.googleapis.com/css?family=Playfair+Display&lt;/a&gt;)&lt;/em&gt;&lt;br&gt;
&lt;em&gt;(&lt;a href="https://fonts.googleapis.com/css?family=PT+Serif" rel="noopener noreferrer"&gt;https://fonts.googleapis.com/css?family=PT+Serif&lt;/a&gt;)&lt;/em&gt;&lt;br&gt;
&lt;em&gt;(&lt;a href="https://fonts.googleapis.com/css?family=Plus+Jakarta+Sans" rel="noopener noreferrer"&gt;https://fonts.googleapis.com/css?family=Plus+Jakarta+Sans&lt;/a&gt;)&lt;/em&gt;&lt;br&gt;
&lt;em&gt;3. Remove the header bar in the builder page, as the logo, the sign-in/sign-out button and the email display (if logged in) will be transferred to the sidebar. The logo must displayed on top of the sidebar (in other words before the CV sections) and the sign-in/sign-out button at the bottom of the sidebar. If the user is logged in, the display of the email should be above the sign out button. Note that these components must stay in place on the sidebar (only the CV sections on the sidebar may scroll). DO NOT DELETE THE HEADER COMPONENT FROM THE FILE STRUCTURE AS IT WILL BE USED FOR THE LANDING PAGE.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;4. The current builder page is very sketchy. The sidebar and the pdf preview section scrolls along with the main page or the center component. Make it so that the sidebar and the center (content section) scroll independently and that the pdf preview would stay in place (Possible solution is to place the section cards in a separate container like SectionsContainer.jsx so that the side components wouldn't scroll along with the middle section).&lt;/em&gt;&lt;br&gt;
&lt;em&gt;5. The pdf preview section must extend to the bottom of the page. What I am currently seeing in my website is that there is so much empty space between the bottom of the page and the pdf preview section. This section must not scroll along with the main contents (center) of the page.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;6. The delete button exists on each of the content cards (except the Personal Details section since it is required for the user to fill up), however the delete button is completely camouflaged within the section card, making the user have a hard time finding the delete button when he does not need that section.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;7. Please also add a button for toggling and collapsing button for each added section to improve the usability of the client. When a section card is collapsed, it must follow that the values or inputs of the user are preserved for rendering the CV output.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;8. The Auth Modal is too generic. If you can help me reformat the Auth Modal, the logo must be placed on the left side, whereas the log in / sign up form would be placed on the right. On top of the form would be a Title text that displays "Want to save your CV permanently? Log in for free!". Also, add the text where if you do not have an account you would be directed to the sign up section and the text where if you already have an account you would be directed to the log in section.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;9. REMOVE ALL EMOJIS!!!! WHO IN THE RIGHT MIND WOULD PLACE EMOJIS IN THEIR UI????&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;"&lt;br&gt;
Now that is a prompt that is very structured with an angry tone, set constraints, context, and instructions. I am just mad at this point because I am starting to get fed up with the sloppy codebase I got from AI. This is what it the page looks like after the prompt.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8j01wq7h3krl56nhc54l.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8j01wq7h3krl56nhc54l.png" alt="Current progress of the project" width="800" height="374"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Current progress of the project&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It was amazing, but it actually forgot about the guidelines for responsive mobile design. I prompted Kiro to fix that issue and it actually responds for mobile user.&lt;/p&gt;

&lt;p&gt;What is not amazing is that the PDF doesn't render proper LaTeX. As you can see in the PDF only renders simpleton text and per every section it only renders 1-3 input fields only. In addition, if a section is empty, let's say I add an entry for Experience, if the website generates the pdf output, instead of printing nothing for that section, it prints a raw JSON blob and it may compromise the security of the entire system! There are several more known quirks in the renderer system that I don't want to mention because I am tired dealing with all of this mess.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I feel after the struggles
&lt;/h3&gt;

&lt;p&gt;If I am being honest with you, I really hated everything about what I have done to my repository. I hated every single moment eating the slop AI vomited on me. Here, come take a look into it. Clone the following repo and test the systems if you want to: &lt;a href="https://github.com/zachenricotia-design/LaTeX-CV" rel="noopener noreferrer"&gt;https://github.com/zachenricotia-design/LaTeX-CV&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Everything you see in this repo is all vibe coded content if not purely generated by AI. What could have been a promising project for my portfolio already got dumped into the wastelands. Not only am I disappointed of how it went, I also became disappointed with myself. I started comparing myself with others how much they accomplished during the summer, and now I am stuck thinking I wasted my summer doing nothing but coding AI slop.&lt;/p&gt;

&lt;p&gt;Now I don't really want to end this blog with a bitter note. After all this would never be a reflection if I learned nothing about this experience, right? I will be sharing what I have learned about my experience with letting AI code the entire thing, what it says about AI and what it says about me.&lt;/p&gt;

&lt;h3&gt;
  
  
  What the project says about me
&lt;/h3&gt;

&lt;p&gt;Before I share what I learned about AI, I want take the time first to reflect about myself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I am very stubborn.&lt;/strong&gt; I have heard so many advices from experts and friends not to be overreliant on AI. But I didn't listen. How am I supposed to learn if I let AI do all of the work? Imagine not learning anything about the frontend stack (React) after all that training from a workshop I attended last April. How can I learn how to construct reusable UI components if I only let AI do the work? Imagine going from a speaker of basic REST API from PostgreSQL database to letting AI code the database and the API endpoints. Instead of learning how use JSON inside a database, I let AI do it and it was one of the worst ideas ever. I really fell off, didn't I? With that said,&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I became lazy, stupid, and irresponsible.&lt;/strong&gt; Since I became overreliant with AI and let it do the work for me, I lost all the motivation to learn something in this project. In other words, I let AI rot my brain to the point it replaced my ability to think like a developer. I can't even decide if the code is well written or buggy, instead I let AI fix it as if he is my idol. It's like I am starting to escape the responsibility of a developer to learn from every error to fix and test. I became irresponsible with using AI. That one prompt that got block by GitHub Copilot was already a warning I ignored that I may be violating someone's copyright rights. If ever you are reading this and you look through my repo and find something that copies your code, just message me through my socials so that I can take that repository down for good. And&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I stress and procrastinate too much and I sometimes.&lt;/strong&gt; I mean the best time to start building is now, right? Sounds cliche but it is true. I am stressing about trying to finish this project by the time summer ends, because I became worried that I would be left behind the pack. That's why I tend to procrastinate the project and my skills by letting AI do the work for me. I mean I mentioned that I started comparing myself with others which you shouldn't do because it only adds up to the stress. Truth be told there is still a lot of time (foreshadowing) and a lot for me to learn. I am still figuring things out as a 20 year old 2nd year BSCS student. Speaking of which,&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I sometimes set unrealistic goals and I lack skills.&lt;/strong&gt; If you remember what I prompted to Claude for my initial specs for the project, I wanted to make a CV creator app using PostgreSQL, Express.js, Node.js, and React (PERN Stack), but is it really going to be a reliable solution when I would be thinking about security? That's when I didn't know that the stack is based on random choice and it wasn't thought through properly. There would have been better approaches to the building the apps like using AWS cloud services to reinforce the backend system. I realized that building apps isn't all about building the frontend and the backend and the database; I also need to learn how cloud solutions enhance the security and the scalability of the project and how to manage that website. It seems like I have fallen into a trap where I need to develop a large-scale system when I lack the necessary skills to manage the frontend or backend or the security of the app. It's like I had too much on my plate instead of taking it one small step at a time.&lt;/p&gt;

&lt;h3&gt;
  
  
  What the project says about AI
&lt;/h3&gt;

&lt;p&gt;Enough of me moping. This project also has things that can be said about AI. Here are my takes:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI can write code but it is very unstructured&lt;/strong&gt;. &lt;br&gt;
We all get it that AI can write code. Yes, it would larp as a senior developer, until you test the system it built and gives you several errors. Here is why:&lt;/p&gt;

&lt;p&gt;The AIs or agentic models I use to vibe code the entire project would run based on predictions or it would always guess what should come next or which is most appropriate. So the AIs will always be bound to make mistakes at some point. These are so called hallucinations, and you need to be cautious if the information or code is wrong. &lt;/p&gt;

&lt;p&gt;To reduce hallucinations of the AI, one must be able to engineer his prompt in a more structured way: state the role, the context, the tone, the instructions, the expected output, and the constraints. This blog actually challenges you to assess whether my prompts to the AI were good or not. For me, my prompting still needs more improvement as I am not really getting the best out of it.&lt;/p&gt;

&lt;p&gt;In addition, the spec driven development approach for vibe coding also increases the accuracy of the output of the AI, since it would perform tasks based on a foundational structure known as your specs or short for specifications. But it also has it's own limits. If you feed it too much information or specs, the more likely it is for it to hallucinate. If you can observe carefully, my prompt started with "Read SPECS.md and TODO.md..." If the specs and todo markdowns are very, very long documents, the agent would tend to overthink for it to be able to finish the task, leading to less accurate outputs. For me, this is why I had a better experience with AWS Kiro compared to GHCopilot because it only needs an easy approach to the requirements such as spec driven development; the less likely it is for it to overthink as it aims to be direct to the goal. Keep in mind the direct to the goal phrase, because this is important later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI never cares about security.&lt;/strong&gt;&lt;br&gt;
Did you observe what is wrong with the current phase of my landing page? You probably seen some JSON blobs sometimes leaking for empty forms in the website. This may leave the database vulnerable to attacks, right? This is what I mean about AI never caring about security. While it is trying to reach it's goals, it basically ignored the guidelines for security. It never knew how to secure the data in the website. I even explicitly stated it in my prompt to ensure that no security considerations should be violated. I also tried to let Kiro solve the data leak problem, but it still seems to persist. That is one of the problems of AI trying to manage or build a system. Don't get me wrong though, it can code the frontend. I am liking the looks of the website using solid prompts, but it is far from perfect. It may code the backend, but it will always leave vulnerabilities to data security. This is why I should learn how to code secure systems and develop the necessary skills needed to finish the project and know where the system fails and how to debug (or if I specialize frontend, I should know how to build components, or the like, and how to organize it). Unfortunately, there are no shortcuts in building systems, and trying to find those pesky bugs is just the beginning of suffering. But you know what is worse than that suffering?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI IS DANGEROUS!!!&lt;/strong&gt;&lt;br&gt;
One of the risks of the use of AI is that you become too overreliant to it. One of it's effects is that it becomes a brainrot. I mean, me letting AI code everything for me was already rotting my brain to the point I cannot even understand the code and where and what the bugs are and how do I fix it. For every error I find, I let the AI do it for me. In the end, it made me lazy, and I end up getting burned out on what to do if there is another error that appears in the console.&lt;/p&gt;

&lt;p&gt;Moreover, overreliance to AI is actually a security risk in the long run as well. Remember the part when I was trying to fix the SCRAM server error while trying to test if the database was working? That was the time I had problems with the database connection. I let AI try to solve that problems via GHCopilot. GHCopilot selected a Claude Haiku model to solve that problem. However, no matter what it has done to solve the problem, the SCRAM error still exists. But eventually the problem is solved by the AI. Do you know what the AI did in the process to solve that problem? It actually changed my PostgreSQL password like it's dark magic right under my nose. Now if there is some bad actor in Anthropic or GitHub, all of my PostgreSQL databases would be completely compromised and it may cause future damages with my account. Who knows how much more the AI can do if I would use AI this irresponsibly? Whatever the goal is, the AI will always find a way to achieve it regardless of security and safety considerations. &lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Why am I writing this blog? I mean there are so many posts regarding how to code with AI, what to do and what not to do, and I am pretty sure you might have heard from higher years or experts and I am an idiot or I have a skill issue, so there is no way for you to be reading this far, right? Nah, I'd congratulate you for reading this far because I am not only trying to reflect on how much this drained me, but I am trying to send a message to everyone who have great concern about the dangers of AI and those who use AI as well.&lt;/p&gt;

&lt;p&gt;We should think of AI as a kind of drug. A drug can be used to help cure sicknesses and diseases. It is the same way that we can leverage AI to assist us in coding, or any other daily task, but we need to use it responsibly. But if we use drugs irresponsibly, we would eventually become addicted and overreliant to it and it would have adverse effects in our body. The same goes with AI. If we become overreliant with it, then we would lose our ability to learn something new and let AI suck up our critical thinking and our ability to decide or to stand for what's right. It would then harm other people online like in the case of hacking into a company, similar to how drugs influence ourselves and our relationships in a very bad way.&lt;/p&gt;

&lt;p&gt;I am pretty sure you have heard of the news about a former Anthropic and OpenAI employee tweeting about all of us being replaced by AI by 2030 and that nobody in those AI companies are not taking it responsibly. I am also pretty sure you are aware of the Hugging Face incident where a test model of OpenAI hacked that website (but if not, feel free to read the bottom link in the references). If it can change the password of my Postgres, it can also hack other systems as well! That's how dangerous AI can become if we do not use it responsibly. And I am guilty of letting AI take over everything I do, to the point I didn't catch it compromise my data right under my nose.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's next for me?&lt;/strong&gt; To be honest my repository looks like it got blown away by a storm. Will I continue it? Maybe. Just maybe. I might need to bomb the backend because it will never be secure if the AI would write everything. In other words, I might need to do the backend from the top. But if I were to take a "positive" from the repo, I am glad to share it as an experiment that was bound to fail. I let AI code a CV creator app to experiment what it can do and what it can't do. I am not saying that you should replicate this experiment (but if you want to do so, do it at your own risk), I only want to share with you this blog so that you won't make the same mistake as I did. This experiment or project serves as a stark warning on what the AI can do and how dangerous it can be if not used properly. Use AI responsibly.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.ibm.com/think/topics/spec-driven-development" rel="noopener noreferrer"&gt;https://www.ibm.com/think/topics/spec-driven-development&lt;/a&gt;&lt;br&gt;
&lt;a href="https://edition.cnn.com/2026/07/22/tech/openai-hugging-face-ai-cybersecurity" rel="noopener noreferrer"&gt;https://edition.cnn.com/2026/07/22/tech/openai-hugging-face-ai-cybersecurity&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>beginners</category>
    </item>
    <item>
      <title>A Beginner’s Guide to Building a REST API with Express.js, PostgreSQL, and Postman</title>
      <dc:creator>Enrico Tia</dc:creator>
      <pubDate>Sun, 22 Feb 2026 15:05:26 +0000</pubDate>
      <link>https://dev.to/up_min_sparcs/a-beginners-guide-to-building-a-rest-api-with-expressjs-postgresql-and-postman-377e</link>
      <guid>https://dev.to/up_min_sparcs/a-beginners-guide-to-building-a-rest-api-with-expressjs-postgresql-and-postman-377e</guid>
      <description>&lt;p&gt;Co-authored by: &lt;a href="https://dev.to/catacutan_rhea"&gt;Rhea Grace Catacutan&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Ever wonder how websites 'talk'?
&lt;/h3&gt;

&lt;p&gt;We know that databases store the information, but a REST API is the bridge that lets you actually move it. Here is how to build a simple API that creates, retrieves, and manages your data using Express, PostgreSQL, and Postman.&lt;/p&gt;

&lt;h2&gt;
  
  
  Workshop Proper
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;To follow this guide, you will need the following tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Node&lt;/strong&gt;: A runtime environment to run JavaScript and server files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PostgreSQL&lt;/strong&gt;: A database server to store the information used in your API.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VSCode&lt;/strong&gt;: A code editor for writing your backend logic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Postman&lt;/strong&gt;: A tool used to test and debug HTTP requests.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you do not have any of the following software for this workshop, go to the following links for installation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node - &lt;a href="https://nodejs.org/en/download" rel="noopener noreferrer"&gt;https://nodejs.org/en/download&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;PostgreSQL - &lt;a href="https://www.enterprisedb.com/downloads/postgres-postgresql-downloads" rel="noopener noreferrer"&gt;https://www.enterprisedb.com/downloads/postgres-postgresql-downloads&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;VSCode - &lt;a href="https://code.visualstudio.com/download" rel="noopener noreferrer"&gt;https://code.visualstudio.com/download&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Postman - &lt;a href="https://www.postman.com/downloads/" rel="noopener noreferrer"&gt;https://www.postman.com/downloads/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Initialize Node Project
&lt;/h3&gt;

&lt;p&gt;We would create a new folder and open terminal to initialize the project with default configurations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When executed, the console must output something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Wrote to C:\Users\&amp;lt;path_of_working_directory&amp;gt;\package.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note: package.json stores all the configurations of the node project&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Install Required Dependencies
&lt;/h3&gt;

&lt;p&gt;We would be using the express (node.js web application framework), cors, pg (PostgreSQL), dotenv (environment variables) modules.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# We can install the modules individually:&lt;/span&gt;
npm &lt;span class="nb"&gt;install&lt;/span&gt; &amp;lt;module_name&amp;gt;

&lt;span class="c"&gt;# Or install all the required modules in one line&lt;/span&gt;
npm &lt;span class="nb"&gt;install &lt;/span&gt;express cors pg dotenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When installing modules, the console must return something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;added 82 packages, and audited 83 packages in 5s

24 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Install Nodemon
&lt;/h3&gt;

&lt;p&gt;Nodemon allows to run server/node.js files in real time; it updates itself when changes are being saved. The &lt;code&gt;-g&lt;/code&gt; flag means we are downloading this globally, meaning this module can be reused by other node projects.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; nodemon
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Setup Database Connection
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Setup environment variables in a .env file. (NOTE: When using Github, always add it in the .gitignore to keep credentials private. Never show it in a repo)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# .env
# Sample env variable configuration
DB_USER=postgres
DB_PASSWORD=&amp;lt;database_password&amp;gt;
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=&amp;lt;database_name&amp;gt;
# 5432 is the default port where the database is stored
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create Database using Postgres in either psql CLI or pgadmin interface.
&lt;strong&gt;Using psql CLI for database&lt;/strong&gt;: Press enter for everything aside from the password. Type the password you used when setting up your Postgres. (NOTE: It may look blank when you type but it is recording your keystrokes.)&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%2Fpv0b3d9ht5uukovktvew.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%2Fpv0b3d9ht5uukovktvew.png" alt="postgres connection in psql" width="776" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From here, you can now create your database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;your_db_name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fvoap0cjr30k6lg36sn7m.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%2Fvoap0cjr30k6lg36sn7m.png" alt="created database in psql" width="770" height="42"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To use the database you have created we type &lt;code&gt;\c &amp;lt;database_name&amp;gt;&lt;/code&gt; in the CLI to use the database you created.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6l5ywhrq3vcdq284yxro.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%2F6l5ywhrq3vcdq284yxro.png" alt="connect to database in psql" width="774" height="68"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Table creation using pgAdmin&lt;/strong&gt;
Look for your database and open the query tool.&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%2Fes32v1mxe3epzcj9rxrn.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%2Fes32v1mxe3epzcj9rxrn.png" alt="locating database in pgadmin" width="778" height="249"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Here is a sample query to create a table. Say you want to keep track of the records of the clients in a company:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;client_records&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="nb"&gt;SERIAL&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;payment_status&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;commission_status&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;deadline&lt;/span&gt; &lt;span class="nb"&gt;DATE&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F5mn9g03pllkcsv5zc0t3.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%2F5mn9g03pllkcsv5zc0t3.png" alt="querying the database in pgadmin" width="777" height="294"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click run (the play button) to execute the query. &lt;em&gt;(Note: it is possible to run the query in the psql CLI by simply copy pasting the query above)&lt;/em&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%2Fbuuwzinrbz7e1b35dj28.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%2Fbuuwzinrbz7e1b35dj28.png" alt="query success" width="775" height="109"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configure database connection node file (database.js)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//database.js&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;Pool&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;pg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dotenv&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;config&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Pool&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DB_USER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DB_HOST&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;database&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DB_DATABASE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DB_PASSWORD&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DB_PORT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create backend code (index.js). This is where you will place your routing logic for your REST API.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//index.js&lt;/span&gt;

&lt;span class="c1"&gt;//include module headers&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./database&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cors&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;//initialize port number your server wants to listen to&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PORT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;8000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;//Create an express app. This is where operations in the &lt;/span&gt;
&lt;span class="c1"&gt;//backend are used.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;//Declare middleware.&lt;/span&gt;
&lt;span class="c1"&gt;//Allow the server to load resources from other origins&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;cors&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="c1"&gt;//Parse JSON data in requests&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

&lt;span class="c1"&gt;//routing methods go here.&lt;/span&gt;

&lt;span class="c1"&gt;//Listen for connections. This creates the localhost server.&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;PORT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Server running at http://localhost:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;PORT&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  What is REST API
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;REST&lt;/strong&gt; stands for &lt;strong&gt;Representational State Transfer&lt;/strong&gt;. It is an API that interacts with the server to transfer data, resources, and allows communication between the frontend and the backend systems. It is a simple and versatile API to use and implement as it is highly scalable and uniform.&lt;/p&gt;

&lt;p&gt;There are 4 common routing methods for RESTful APIs: &lt;strong&gt;GET, POST, PUT, and DELETE&lt;/strong&gt;. These would correspond to the CRUD operations: Create (POST), Read (GET), Update (PUT), and Delete (DELETE)&lt;/p&gt;

&lt;p&gt;Let's get our hands dirty with it.&lt;/p&gt;

&lt;p&gt;Note that the format of each routing method is as follows&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;route_method&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;route_path&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; 
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//query, template, params&lt;/span&gt;
        &lt;span class="c1"&gt;//parse result&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//code to run when an error occurs&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;GET METHOD (READ)&lt;/strong&gt; - used to retrieve or show data or resources. This is typically supported with the SELECT clause in database query. &lt;br&gt;&lt;br&gt;
Note: Status 500 - Internal Server Error&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/test&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//Say we want to get contents of the database&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;SELECT * FROM table&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="c1"&gt;//The * wildcard would represent all columns from the selected table.&lt;/span&gt;
        &lt;span class="c1"&gt;//You may list specific colums to display specific data.&lt;/span&gt;

        &lt;span class="c1"&gt;//Parse the result in JSON format&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//catch error&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;An error occurred in the server&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sample Database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//index.js&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/test&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;SELECT * FROM client_records&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;An error occurred in the server&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;POST METHOD (CREATE)&lt;/strong&gt; - create or add new resources or data. This is supported with the INSERT clause in the database query &lt;br&gt;&lt;br&gt;
Status 201: Content Created&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/test&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//We could create a template for parameters we would add in our database&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;param1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;param2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="c1"&gt;//query new data into database. Note the order of placeholders in the query as it is replaced by the selected parameters.&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;INSERT INTO table (param1, param2) VALUES ($1, $2) RETURNING *&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;param1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;param2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="c1"&gt;//The first item in the array is what will we be returning in our created resource. The other rows are probably junk and are not needed.&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;201&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

        &lt;span class="c1"&gt;//send configuration of resource&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Resource created successfully&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;An error occurred in the server.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sample Database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//index.js&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/test&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;payment_status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;commission_status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;deadline&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;INSERT INTO client_records (username, payment_status, commission_status, deadline) VALUES ($1, $2, $3, $4) RETURNING *&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;payment_status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;commission_status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;deadline&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;201&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Resource created successfully&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;An error occurred in the server.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;PUT METHOD (UPDATE)&lt;/strong&gt; - update or modify an existing resource or data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/test/:param1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//Create template for target parameter(s).&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;param1&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="c1"&gt;//Create template for parameter(s) we want to change &lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;param2&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="c1"&gt;//Query to modify resource&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s2"&gt;`UPDATE table SET username = $2 WHERE param1 = $1 `&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;param1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;param2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;201&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

        &lt;span class="c1"&gt;//send confirmation of resource&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Resource updated successfully&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;An error occurred in the server.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sample Database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//index.js&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/test/:id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;payment_status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;commission_status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;deadline&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;UPDATE client_records SET username = $1, payment_status = $2, commission_status = $3, deadline = $4 WHERE id = $5 RETURNING *&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;payment_status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;commission_status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;deadline&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;201&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Resource updated successfully&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;An error occurred in the server.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;DELETE METHOD (DELETE)&lt;/strong&gt; - Deletes an existing resource or data&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/test/:param1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//set target parameter&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;param1&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="c1"&gt;//query to delete with the target parameter&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;DELETE FROM table WHERE param1 = $1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;param1&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
        &lt;span class="c1"&gt;//confirm deletion&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Resource deleted successfully&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;204&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;An error occurred in the server.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sample Database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//index.js&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/test/:id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;DELETE FROM client_records WHERE id = $1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Resource deleted successfully&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;204&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;An error occurred in the server.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;For a complete reference of the status code refer to &lt;a href="https://www.restapitutorial.com/httpstatuscodes" rel="noopener noreferrer"&gt;https://www.restapitutorial.com/httpstatuscodes&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to know if each of these methods are working fine?
&lt;/h3&gt;

&lt;p&gt;We would use nodemon to run our backend code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nodemon index.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fimp0z8k7uk4h2o4e53r5.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%2Fimp0z8k7uk4h2o4e53r5.png" alt="running nodemon on bash" width="776" height="150"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note: Ctrl+C to stop the server&lt;/p&gt;

&lt;p&gt;We would test each method in Postman to see if the method works completely fine using the database we have created earlier, in this example, the client_db database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;METHOD 1: GET&lt;/strong&gt;&lt;br&gt;
Type &lt;a href="http://localhost:8000/test" rel="noopener noreferrer"&gt;http://localhost:8000/test&lt;/a&gt; to retrieve the data from your database.&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%2Fmy4l23ljzcnvgacka5tt.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%2Fmy4l23ljzcnvgacka5tt.png" alt="retrieve data using postman" width="776" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(As you can see, when you type this down our database is still empty. We will change that by using the POST method.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;METHOD 2: POST&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to Body. Set to raw and JSON.&lt;/li&gt;
&lt;li&gt;Type down values for each attribute. 
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sample input:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;JSON&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;   
&lt;/span&gt;&lt;span class="nl"&gt;"username"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vaizravana"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"payment_status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Fully Paid"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"commission_status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Completed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"deadline"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2025-07-12"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Click Send.&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%2Fsuzeqqexevpzrjahzfzw.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%2Fsuzeqqexevpzrjahzfzw.png" alt="post method in postman" width="776" height="238"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now let’s check using GET method. We now have successfully created our first data.&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%2F1yn3n81gvas5kwjcl191.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%2F1yn3n81gvas5kwjcl191.png" alt="get method in postman, showing the first row of data" width="779" height="407"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;METHOD 3: PUT&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To change the values, use the PUT method. In this example, we want to alter the payment_status and commission_status of himari.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Post this input to have 2 data set on your database.)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;JSON&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"username"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"himari"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"payment_status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Partially Paid"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"commission_status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Work in Progress"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"deadline"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-02-26T16:00:00.000Z"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You must get this kind of output in Postman&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%2Fxg6rt28lbg00tzdbwhon.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%2Fxg6rt28lbg00tzdbwhon.png" alt="Postman output having two rows of data in the database" width="780" height="266"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, add the index of what you want to change to the url. In this case,
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://localhost:8000/test/2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Go to Body. Set to raw and JSON.&lt;/li&gt;
&lt;li&gt;Write down all the attributes and change what is needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sample input:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;JSON&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"username"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"himari"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"payment_status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Fully Paid"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"commission_status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Completed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"deadline"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-02-26T16:00:00.000Z"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Click Send. The changes have been now added.&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%2Fyxsm6puyaiuz34y440lz.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%2Fyxsm6puyaiuz34y440lz.png" alt="put method in postman" width="779" height="222"&gt;&lt;/a&gt;&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%2F2mkgpaw1rzye5socohmp.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%2F2mkgpaw1rzye5socohmp.png" alt="put method in postman verified by get method" width="774" height="252"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;METHOD 4: DELETE&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To choose what data to delete, just add the index at the end of the url.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://localhost:8000/test/2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Click Send.&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%2Fm7mihz9eie5o6m4ho1rj.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%2Fm7mihz9eie5o6m4ho1rj.png" alt="delete method in postman" width="774" height="113"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“id” : 2 has now been deleted.&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%2F43b0et3zsf33saozzwit.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%2F43b0et3zsf33saozzwit.png" alt="delete method successful as shown by get method" width="776" height="278"&gt;&lt;/a&gt;&lt;/p&gt;




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

&lt;p&gt;&lt;strong&gt;Congratulations!&lt;/strong&gt; You have successfully created a REST API! You may use this interface in your own website or software and connect with the frontend (if you want), or now that you know how to create a basic REST API, you can experiment further with different routing methods, query optimization, more on express.js and node, and others.&lt;/p&gt;

&lt;p&gt;Based on experience, learning how to use and implement API for the first time feels like climbing a steep mountain without any proper equipment or tools, especially when it is required for a project. However, learning REST API is straightforward, as it uses familiar HTTP requests such as the GET, POST, PUT, and DELETE. It is also highly scalable with its statelessness, making it process server-side requests very quickly. Moreover, Express.js provides templates for each routing method making RESTful APIs simpler to implement.&lt;/p&gt;

&lt;h2&gt;
  
  
  References:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.restapitutorial.com/introduction" rel="noopener noreferrer"&gt;https://www.restapitutorial.com/introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/node-js/rest-api-introduction/" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/node-js/rest-api-introduction/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=ldYcgPKEZC8" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=ldYcgPKEZC8&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm" rel="noopener noreferrer"&gt;https://docs.npmjs.com/downloading-and-installing-node-js-and-npm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.w3schools.com/postgresql/index.php" rel="noopener noreferrer"&gt;https://www.w3schools.com/postgresql/index.php&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://expressjs.com/en/guide/routing.html" rel="noopener noreferrer"&gt;https://expressjs.com/en/guide/routing.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://expressjs.com/en/starter/installing.html" rel="noopener noreferrer"&gt;https://expressjs.com/en/starter/installing.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/blogs/why-rest-api-is-important-to-learn/" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/blogs/why-rest-api-is-important-to-learn/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.alexrusin.com/5-key-benefits-of-using-express-in-your-node-js-projects/" rel="noopener noreferrer"&gt;https://blog.alexrusin.com/5-key-benefits-of-using-express-in-your-node-js-projects/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>learning</category>
      <category>node</category>
    </item>
  </channel>
</rss>
