<?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: Daniel</title>
    <description>The latest articles on DEV Community by Daniel (@adjeijrdev).</description>
    <link>https://dev.to/adjeijrdev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1227678%2Feffd86cb-754d-4fd6-a4d1-f3a40f904b6c.png</url>
      <title>DEV Community: Daniel</title>
      <link>https://dev.to/adjeijrdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/adjeijrdev"/>
    <language>en</language>
    <item>
      <title>API Endpoints or Routes✈</title>
      <dc:creator>Daniel</dc:creator>
      <pubDate>Fri, 15 Dec 2023 18:08:43 +0000</pubDate>
      <link>https://dev.to/adjeijrdev/api-endpoints-or-routes-17g0</link>
      <guid>https://dev.to/adjeijrdev/api-endpoints-or-routes-17g0</guid>
      <description>&lt;p&gt;How often have you heard about endpoints or routes in APIs but found it difficult to grasp? 🙂😑. Come with me😎, as you reach the end of this article, you will feel comfortable whenever you encounter terms like 'endpoints' or 'routes.' Additionally, you'll be able to implement them on your own using Node.js and Express.😊😉..&lt;/p&gt;

&lt;h2&gt;
  
  
  What are endpoints or routes?🤷‍♂️😪
&lt;/h2&gt;

&lt;p&gt;Endpoints are the app's units of executable request-handling code. Huhh??🙄🙂.. Simply put, &lt;strong&gt;an endpoint or route is, as its name implies, basically a pathway or road 🚘🚆 that leads to a destination..&lt;/strong&gt; That is, as known from the knowledge of what an API is from the first episode of &lt;strong&gt;"Your first backend project"&lt;/strong&gt; [&lt;em&gt;you could check on it, if you missed it&lt;/em&gt; &lt;a href="https://dev.to/adjeijrdev/your-first-backend-project-20gl"&gt;Your first backend project - 1&lt;/a&gt;] &lt;strong&gt;So an API we got to know is a single link that leads you to a specific application &lt;u&gt;&lt;em&gt;which will allow you to access resources, post(save) resources or utilize a function/processes/methods already implemented in an application&lt;/em&gt;&lt;/u&gt;&lt;/strong&gt; Hence each of the options would have a path on the parent URL respectively. Cool?😁...&lt;/p&gt;

&lt;h2&gt;
  
  
  Routes in skeleton😂😎
&lt;/h2&gt;

&lt;p&gt;Now that we've grasped the essence of routes/endpoints, let's delve into the details and solidify our understanding once and for all! 😎😉 No time to waste here! 😎&lt;br&gt;
Imagine the link to &lt;strong&gt;Amazon&lt;/strong&gt; 🎁 as our &lt;strong&gt;API&lt;/strong&gt;. Folks 😁, visit our API at &lt;a href="//www.amazon.com"&gt;www.amazon.com&lt;/a&gt;. Clicking on the link takes you to an &lt;strong&gt;APPLICATION&lt;/strong&gt; created by someone. Once you land on the Amazon page, you'll discover numerous options within the application, beyond just buying or viewing. It's packed with various functions, and each function is accomplished through a route.&lt;br&gt;
For instance, when you click on 'registry,' a link or route like &lt;a href="//www.amazon.com/registries"&gt;www.amazon.com/registries&lt;/a&gt; is what guides you to that specific service. Folks, that's a route! 😂😀 Isn't this breathtaking? 😁😂.. So, from the new link &lt;a href="//www.amazon.com/registries"&gt;www.amazon.com/registries&lt;/a&gt;, we can still see &lt;strong&gt;&lt;a href="http://www.amazon.com"&gt;www.amazon.com&lt;/a&gt;&lt;/strong&gt;, our &lt;strong&gt;API&lt;/strong&gt;, and &lt;strong&gt;/registries&lt;/strong&gt;. Therefore, &lt;strong&gt;/registries&lt;/strong&gt; is our endpoint or route, and &lt;strong&gt;&lt;a href="http://www.amazon.com"&gt;www.amazon.com&lt;/a&gt;&lt;/strong&gt; is our &lt;strong&gt;&lt;u&gt;application/API/Parent URL&lt;/u&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's write our Endpoints or Routes too!😉🧐
&lt;/h2&gt;

&lt;p&gt;So, before we dive into writing our codes, let's carefully note how applications work. We interact with an application by &lt;u&gt;requesting&lt;/u&gt; the Amazon platform to help us with a little Christmas🛍 shopping. In turn, Amazon &lt;u&gt;responds&lt;/u&gt; to us with various items we need for a happy Christmas! 🎆🎄. Carefully get your Christmas stuffs down!😉🚀 from Amazon. so you see we have two operations here: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;we &lt;strong&gt;Request&lt;/strong&gt; and&lt;/li&gt;
&lt;li&gt;Amazon in turn &lt;strong&gt;Respond&lt;/strong&gt;
Hence, the first step is to find yourself at a route, initiate a request, and then await a response.😎 Clear? That is all about it. C'mon we've talked plenty no codes🚀.. let's write some codes.👨‍💻&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Implementing our codes
&lt;/h2&gt;

&lt;p&gt;By now, you should be good to go with setting up your backend project. Installing the Express package and configuring it is just a piece of cake for a pro! 😎😉 If you haven't read the initial article, check it out &lt;a href="https://dev.to/adjeijrdev/your-first-backend-project-20gl"&gt;Your first backend project - 1&lt;/a&gt;]!&lt;br&gt;
After setup--this is from the previous article&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C0_PMwzA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hhl31zqvo76h8l6q31df.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C0_PMwzA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hhl31zqvo76h8l6q31df.png" alt="API setup" width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  HTTP REQUEST METHODS🚀🪂
&lt;/h2&gt;

&lt;p&gt;Don't be frightened by the heading. It's as simple as it will always be for a pro like you! 😁👨‍💻!. As we have learned from above, we interact with applications by &lt;strong&gt;request&lt;/strong&gt;ing an action. 😎 But have you realized that even though you interact with the application by requesting, there are different things you can ask the application to do for you?🤷‍♂️ This could include filling out a form🌠, deleting items from your Google Drive, updating your status, or simply getting an interesting article like this 😁😎 to read😎🤷‍♂️..&lt;br&gt;
So these various activities are called the &lt;strong&gt;METHODS&lt;/strong&gt;! So, applications use several methods to implement our requests based on what we desire, but four are mostly used and dominant: GET, POST, DELETE, and PUT. These terms might not be so strange if you think about them in the context of English vocabulary, right? 😉😁. So:&lt;/p&gt;

&lt;p&gt;1.&lt;strong&gt;GET&lt;/strong&gt; is used to retrieve or read information&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;POST&lt;/strong&gt; is utilized for creating data within an application or feeding it with information, just like filling out a form.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DELETE&lt;/strong&gt; is employed to remove or delete information&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PUT&lt;/strong&gt; is used to update an already existing information.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All Knowledge needed for implementing a route is settled, lets see an anatomy of if it and wrap up!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TXwz4jgy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19plksy14ujznluqr3gy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TXwz4jgy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19plksy14ujznluqr3gy.png" alt="Anatomy" width="800" height="263"&gt;&lt;/a&gt;&lt;br&gt;
Let's break it down and see from the various sections of the code.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;app&lt;/strong&gt; is the initialized express package we installed for our API setup in the first article.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;".get()"&lt;/strong&gt; is a &lt;strong&gt;method&lt;/strong&gt; called on the &lt;strong&gt;app&lt;/strong&gt;([&lt;strong&gt;&lt;em&gt;const app = express()&lt;/em&gt;&lt;/strong&gt;] which is obviously the package necessary for our API project)😉. So it means we could also use &lt;strong&gt;.post()&lt;/strong&gt;, &lt;strong&gt;.put()&lt;/strong&gt;, &lt;strong&gt;.delete()&lt;/strong&gt; &lt;strong&gt;methods&lt;/strong&gt;.We could see the method takes in two parameters, which is explained below:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;"/read"&lt;/strong&gt; is the first parameter in the &lt;strong&gt;METHOD&lt;/strong&gt;(not only get(), but for the rest as well) for our route or endpoint! 🪂 That means, in the address bar after inserting our parent URL, we only add "/read" to navigate to this route or endpoint. So, suppose our parent URL/API is &lt;a href="http://www.ourbackend.com"&gt;www.ourbackend.com&lt;/a&gt;. Then this particular endpoint will be &lt;a href="http://www.ourbackend.com/read"&gt;www.ourbackend.com/read&lt;/a&gt;  🚀. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The second parameter, which is &lt;strong&gt;"(request, response) =&amp;gt; { response.send("You want to read an article like the one you are reading?") },"&lt;/strong&gt; is always a callback function. This function is invoked immediately when this endpoint is called upon 💻. So, in this case, if our endpoint is indeed &lt;a href="http://www.ourbackend.com/read"&gt;www.ourbackend.com/read&lt;/a&gt;, when someone calls this endpoint, they will see the &lt;strong&gt;response&lt;/strong&gt;: &lt;strong&gt;'You want to read an article like the one you are reading?'&lt;/strong&gt; because the application is responding with that! 🖥🚀 This is breathtaking, seasoned pro!👨‍💻🪂. Clear?🥱😎. Fellas, that means the callback function could be written to do anything whatsoever! Like: allowing user to register a form, delete a blog, update a blog, etc.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Warm up skills😎🚀👨‍💻
&lt;/h2&gt;

&lt;p&gt;Fellas, you've read quite a bit, and now it's time to put your knowledge into action! As a warm-up for the real implementations in the next blog 💬🚀👨‍💻, let's modify the endpoints using various methods like &lt;strong&gt;post()&lt;/strong&gt;, &lt;strong&gt;put()&lt;/strong&gt;, and others. Keep the same format, but change the message and methods. This practice will help stabilize your understanding. In the next article, we'll delve into real implementations and explore industrial-standard tools for testing. Remember, the web browser can only test &lt;strong&gt;get()&lt;/strong&gt; method, so don't miss out on that for anything! 😪😉 Gear up for some hands-on experience to activate your seasoned pro spirit! 😁👨‍💻📲&lt;/p&gt;

&lt;p&gt;Don't forget to &lt;strong&gt;react&lt;/strong&gt; to the article and &lt;strong&gt;comment&lt;/strong&gt; as well! 😎📲 Let's build a community of fellow devs!&lt;br&gt;
see below for the first article!&lt;br&gt;
&lt;a href="https://dev.to/adjeijrdev/your-first-backend-project-20gl"&gt;Your first backend project - 1&lt;/a&gt;]&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>api</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Your First Backend Project</title>
      <dc:creator>Daniel</dc:creator>
      <pubDate>Thu, 07 Dec 2023 01:04:49 +0000</pubDate>
      <link>https://dev.to/adjeijrdev/your-first-backend-project-20gl</link>
      <guid>https://dev.to/adjeijrdev/your-first-backend-project-20gl</guid>
      <description>&lt;p&gt;Are you interested in creating a backend for yourself but has no clue as to how to go about it?😌 Worry less😉, in this article I will hold your hands gradually until you finally build &lt;strong&gt;your first backend project&lt;/strong&gt;!&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's get started!
&lt;/h2&gt;

&lt;p&gt;Many programming languages will definitely  allow you create a backend project(API). Among them are python(Django),java(spring),php(Laravel), etcetera. However they are all spearheaded by NodeJS according to stack overflow survey 2023 &lt;a href="https://survey.stackoverflow.co/2023/#most-popular-technologies-webframe" rel="noopener noreferrer"&gt;https://survey.stackoverflow.co/2023/#most-popular-technologies-webframe&lt;/a&gt;, and then it also beginner friendly!🏹.&lt;/p&gt;

&lt;h2&gt;
  
  
  Environment setup
&lt;/h2&gt;

&lt;p&gt;Let's setup our environment! NodeJS is simply a JavaScript runtime. Therefore JavaScript must be part of your environment in order to start hacking! This is JavaScript away from the web browser! click on this link to install &lt;a href="https://nodejs.org/en" rel="noopener noreferrer"&gt;https://nodejs.org/en&lt;/a&gt; your NodeJS. Advisory: select the &lt;strong&gt;&lt;em&gt;Recommended For most Users&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Set? let's get our hands dirty!&lt;/p&gt;

&lt;h2&gt;
  
  
  What at all is an API or Backend?🤷‍♂️😑
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;A&lt;/strong&gt;pplication &lt;strong&gt;P&lt;/strong&gt;rogramming &lt;strong&gt;I&lt;/strong&gt;nterface(&lt;strong&gt;API&lt;/strong&gt;) is a way for two or more computer programs to communicate with each other.🙄    what?&lt;br&gt;
Simply see an &lt;strong&gt;API&lt;/strong&gt; as a &lt;em&gt;&lt;strong&gt;link&lt;/strong&gt;&lt;/em&gt; or &lt;strong&gt;&lt;em&gt;URL&lt;/em&gt;&lt;/strong&gt; to a particular &lt;strong&gt;resources&lt;/strong&gt; or &lt;strong&gt;files&lt;/strong&gt;, such as a link to someone's google drive!🌍. So an API is another application that has got &lt;strong&gt;resources&lt;/strong&gt;, &lt;strong&gt;functions&lt;/strong&gt; or &lt;strong&gt;processes&lt;/strong&gt; that you access the &lt;strong&gt;"link/url"&lt;/strong&gt; in your own application for a soft life!🥱... skipping all the troubles for building those functions or resources from scratch! With this out of the way let's rock and roll!👨‍💻. Let's create our own API to have people access our  resources too!😎😉&lt;/p&gt;

&lt;h2&gt;
  
  
  Backend or API setup
&lt;/h2&gt;

&lt;p&gt;now let's rush into our code editor, preferably Vs code, you can download it via this link &lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;https://code.visualstudio.com/&lt;/a&gt;. Create a directory(folder) for your project and navigate into it and open a terminal from vs code or mac or  &lt;strong&gt;cmd&lt;/strong&gt; on windows. Set up your project by the command below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Feo42dcydoxxrzlifrerh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Feo42dcydoxxrzlifrerh.png" alt="Initializing project"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you have run the command, you will be asked to answer some few questions about your project, such as package-name, version, description, main etc. I entreat you answer only the package name(&lt;em&gt;inputs must be in lower case and separated by hyphens or under scot&lt;/em&gt;), the rest skip by clicking on the return key or enter key. Your final response will be like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Ftvs5jq71j0ds4w7qq04o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Ftvs5jq71j0ds4w7qq04o.png" alt="Package.json"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;from my result I answered only the &lt;strong&gt;package name&lt;/strong&gt; as &lt;strong&gt;my-first-api.&lt;/strong&gt; you could see a file has automatically been generated  called &lt;strong&gt;package.json&lt;/strong&gt;. No worries this gives a description of the project. &lt;/p&gt;

&lt;p&gt;Create a file called &lt;strong&gt;index.js&lt;/strong&gt; since in our project description(&lt;strong&gt;package.json&lt;/strong&gt;) file, since our &lt;strong&gt;main&lt;/strong&gt; has a &lt;strong&gt;value index.js&lt;/strong&gt; , you could change it to your preference!👨‍💻.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing our framework
&lt;/h2&gt;

&lt;p&gt;NodeJS uses a framework called express to help create our &lt;strong&gt;"API"&lt;/strong&gt; or our link to the resources, functions, among others. with ease! In order to incorporate in our application we first have to install it. &lt;br&gt;
&lt;a href="https://media.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%2F3ur0lr2imc01y93cb80a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F3ur0lr2imc01y93cb80a.png" alt="installing Express"&gt;&lt;/a&gt;&lt;br&gt;
express is now installed in our application, you could verify from the &lt;strong&gt;package.json&lt;/strong&gt; file. Don't be bothered about the two add ups in the directory(&lt;strong&gt;package-lock.json and node_modules&lt;/strong&gt;) they are necessary for express to run!😉.. &lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a simple API📲
&lt;/h2&gt;

&lt;p&gt;Just as it has been explained that an API is an application that sits somewhere on a server, but can be accessed through a URL to perform certain operations such as: getting resources, creating resources, deleting resources, updating resources, etc. So an API should basically have a &lt;strong&gt;URL&lt;/strong&gt; to access it and some &lt;strong&gt;functions&lt;/strong&gt; or &lt;strong&gt;resources&lt;/strong&gt;(either for cash payments, movie display, or what have you?). &lt;/p&gt;

&lt;p&gt;we will use the ES6 JavaScript syntax for our application, hence we will have to modify our project description, thus &lt;strong&gt;package.json&lt;/strong&gt; as follows:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fh8rjln6zvr5wul9yweay.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fh8rjln6zvr5wul9yweay.png" alt="package.json modification for es6"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;so under the &lt;strong&gt;"main":"index.js"&lt;/strong&gt; write another key-value &lt;br&gt;
&lt;strong&gt;"type":"module"&lt;/strong&gt;. Now all is set! open the &lt;strong&gt;index.js&lt;/strong&gt; file and let's write our API that performs a function. Let's import our express framework so we can use it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fwwzh7hc929myw7obxj5y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fwwzh7hc929myw7obxj5y.png" alt="Import Express"&gt;&lt;/a&gt; &lt;br&gt;
We have successfully imported our express framework and instantiated ready to use the various methods/functions on it. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Streaming our API to be accessed&lt;/strong&gt; &lt;br&gt;
just as we said, an API should have the potential to be accessed, that means it should have a URL for accessibility! Let's create our local URL. Let's modify our code in the index.js file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F6szirnk9qc2fqv0fyg8m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F6szirnk9qc2fqv0fyg8m.png" alt="Listening on a Port Number"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;listen is a method on the app for streaming your API live, it takes the port number and a call back function, modify it to your own preference!. You could &lt;strong&gt;run node index.js&lt;/strong&gt; in your terminal to &lt;em&gt;Deploy and host your API locally for live testing&lt;/em&gt;. go to your address bar of your favorite web browser and type "localhost:&lt;strong&gt;port-number&lt;/strong&gt;" as used in the code, in this case we used &lt;strong&gt;3001&lt;/strong&gt;. You will realize your browser has responded to the URL but has not returned any function or resource, because we have not created any!&lt;/p&gt;

&lt;p&gt;Let's create some functions to access on the URL or our API&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fsi8iwzu03h6kfnkkujvu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fsi8iwzu03h6kfnkkujvu.png" alt="Adding endpoints"&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;
we modified our code to have three different functions accessed from our application(API), all these functions are called on a unique URL(route or endpoint) on the same base URL of our application &lt;strong&gt;localhost:3001&lt;/strong&gt;. The first function is called on the base route &lt;strong&gt;"/"&lt;/strong&gt;, which implies &lt;strong&gt;'localhost:3001/'&lt;/strong&gt; which will return &lt;strong&gt;"This is your home page"&lt;/strong&gt; on the browser.&lt;br&gt;
The second is also accessed on the "/About" route, which also implies &lt;strong&gt;'localhost:3001/About'&lt;/strong&gt; which will return &lt;strong&gt;"This is your About page"&lt;/strong&gt; on the browser.&lt;br&gt;
The third is also accessed on the "/Contact" route, which also implies &lt;strong&gt;'localhost:3001/Contact'&lt;/strong&gt; which will also return &lt;strong&gt;"This is your Contact page"&lt;/strong&gt; on the browser...&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;TEST YOUR API&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Run node index.js in a terminal, then check in the terminal for the call back function to log &lt;strong&gt;"My Api is running on Port 300"&lt;/strong&gt;. access your API on the browser by using your URL's above.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Congratulations!!!&lt;/strong&gt; you have created your first API that has three different endpoints which returns an information! As said above API could allow you to store resources and access resources and many other functionalities!😍...  However this was an article to bring you to the light of API's. &lt;strong&gt;This is part 1.&lt;/strong&gt;  "Stay tuned for the upcoming Part 2 as we continue our journey in Backend Development, guiding you until you become a seasoned pro! Keep an eye out! 😁😎 Keep practicing, and Happy Hacking!"&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>node</category>
      <category>api</category>
    </item>
  </channel>
</rss>
