{"id":87563,"date":"2023-05-26T09:52:50","date_gmt":"2023-05-26T04:22:50","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=87563"},"modified":"2023-05-26T09:52:50","modified_gmt":"2023-05-26T04:22:50","slug":"events-in-nodejs","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/","title":{"rendered":"Events in Nodejs"},"content":{"rendered":"<p>Node.js is an event-driven programming language that is particularly good at handling asynchronous tasks. One of the key features of Node.js is its event system, which allows you to respond to events and trigger actions in your application. In this article, we&#8217;ll explore events in Node.js and how they can be used to create dynamic and responsive applications.<\/p>\n<h3>What is an event in Nodejs?<\/h3>\n<p>An event is a signal that a certain action has occurred in your application, such as a button click or a file upload. In Node.js, events are represented by the EventEmitter class, which provides a way to register listeners for events and trigger events when certain actions occur.<\/p>\n<p>Here&#8217;s a simple example of using the EventEmitter class in Node.js:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const EventEmitter = require('events');\n\nconst myEmitter = new EventEmitter();\n\n\/\/ Register a listener for the 'greeting' event\n\nmyEmitter.on('greeting', (name) =&gt; {\nconsole.log(`Hello, ${name}!`);\n});\n\n\/\/ Trigger the 'greeting' event\nmyEmitter.emit('greeting', 'John');<\/pre>\n<p>In this example, we create a new instance of the EventEmitter class and register a listener for the &#8216;greeting&#8217; event. When the &#8216;greeting&#8217; event is triggered, the listener will be called with the name argument, which is passed as the second argument to the emit method.<\/p>\n<p>Events in Node.js can also be used to create more complex and dynamic applications. For example, you could use events to respond to user input in real-time, such as updating a dashboard when a new message is received. Here&#8217;s an example of using events to create a simple chat application:<\/p>\n<p>Events can also be used to create more complex and dynamic applications. For example, you could use events to respond to user input in real-time. Here&#8217;s an example of using events to create a simple chat application:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const EventEmitter = require('events');\n\nconst chat = new EventEmitter();\n\n\/\/ Register a listener for the 'message' event\n\/\/ setting a listener for the \u2018message\u2019 event\nchat.on('message', (user, message) =&gt; {\nconsole.log(`${user}: ${message}`);\n});\n\n\/\/ Send a message to the chat\nchat.emit('message', 'John', 'Hello, everyone!');<\/pre>\n<p>In this example, we create a new instance of the EventEmitter class and register a listener for the &#8216;message&#8217; event. When a message is sent to the chat, the listener will be called with the user and message arguments, which are passed as the second and third arguments to the emit method.<\/p>\n<p>The listener is called with the user and message arguments when a message is sent to the chat, passed as the second and third arguments to the emit method.<\/p>\n<p>There are a few additional things that students should know about events in Node.js:<\/p>\n<p><strong>1. Events can be asynchronous:<\/strong> When an event is triggered, the listener function is executed asynchronously. This means that the listener function may not run immediately, but rather at some point in the future when the event loop processes the event.<\/p>\n<p><strong>2. You can pass multiple arguments to an event:<\/strong> When you trigger an event using the <strong>emit<\/strong> method, you can pass any number of arguments after the event name. These arguments will be passed to the listener function as individual arguments.<\/p>\n<p><strong>3. You can remove event listeners:<\/strong> If you no longer need to listen for a particular event, you can remove the listener using the <strong>removeListener method<\/strong>. This method takes the event name and the listener function as arguments.<\/p>\n<p><strong>4. Some built-in Node.js modules use events:<\/strong> Many of the built-in modules in Node.js use events to provide asynchronous functionality. For example, the <strong>http<\/strong> module uses events to handle incoming requests and send responses.<\/p>\n<p>By understanding these additional concepts, you&#8217;ll have a better understanding of how events work in Node.js and how they can be used to create powerful and flexible applications. With practice and experience, you&#8217;ll be able to use events to create complex and responsive applications that can handle a wide variety of tasks.<\/p>\n<p>Understanding these concepts will improve your knowledge of Node.js events and their potential for creating dynamic applications. With experience, you can leverage events to develop responsive applications that can handle diverse tasks.<\/p>\n<h3>Passing arguments and this to listeners:<\/h3>\n<p>When an event is emitted in Node.js, listeners are called with the data passed as arguments. For instance, consider the following code:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const EventEmitter = require('events');\n\nconst myEmitter = new EventEmitter();\n\nmyEmitter.on('event', (arg1, arg2) =&gt; {\nconsole.log(`${arg1} ${arg2}`);\n});\n\nmyEmitter.emit('event', 'Hello', 'World');<\/pre>\n<p>In the above example, when the<strong> \u2018event\u2019<\/strong> is emitted, the listener function is called with the arguments<strong> \u2018Hello\u2019<\/strong> and <strong>\u2018World\u2019<\/strong>. The listener function then logs<strong> \u2018Hello World\u2019<\/strong> to the console.<\/p>\n<p>Similarly, the <strong>\u2018this\u2019<\/strong> keyword can be used to refer to the event emitter object within the listener function. For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const EventEmitter = require('events');\n\nclass MyEmitter extends EventEmitter {}\n\nconst myEmitter = new MyEmitter();\n\nmyEmitter.on('event', function() {\nconsole.log(this === myEmitter); \/\/ true\n});\n\nmyEmitter.emit('event');<\/pre>\n<p>In the above example, the<strong> \u2018this\u2019<\/strong> keyword is used within the listener function to check if it is equal to the<strong> \u2018myEmitter\u2019<\/strong> object. Since <strong>\u2018this\u2019<\/strong> refers to the <strong>\u2018myEmitter\u2019<\/strong> object within the listener function, the output will be<strong> \u2018true\u2019.<\/strong><\/p>\n<p>Finally, developers can use the<strong> \u2018once\u2019<\/strong> method to create one-time event listeners that are automatically removed once the event is emitted. For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const EventEmitter = require('events');\n\nconst myEmitter = new EventEmitter();\n\nmyEmitter.once('event', () =&gt; {\nconsole.log('This will only be logged once');\n});\n\nmyEmitter.emit('event');\nmyEmitter.emit('event');<\/pre>\n<p>In the above example, the <strong>\u2018once\u2019<\/strong> method is used to create an event listener that logs a message to the console. However, since the <strong>\u2018once\u2019<\/strong> method is used, the listener is removed automatically once the <strong>\u2018event\u2019<\/strong> is emitted. Therefore, the message is logged only once, even though the <strong>\u2018event\u2019<\/strong> is emitted twice.<\/p>\n<h3>Asynchronous vs synchronous Events in Nodejs<\/h3>\n<p>Node.js events allow developers to create asynchronous and synchronous code that responds to various events within their applications. Asynchronous events are non-blocking, while synchronous events are blocking.<br \/>\nFor example, let&#8217;s say we have a web application that needs to retrieve data from a database. Using synchronous events, the application would pause until the data is retrieved, which can cause performance issues if the database is slow.<\/p>\n<p>On the other hand, using asynchronous events, the application can continue to process requests while the data is being retrieved.<\/p>\n<p>To use asynchronous events in Node.js, developers can use the built-in<strong> \u2018EventEmitter\u2019<\/strong> module to emit events and attach listeners to process them asynchronously. Here&#8217;s an example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const EventEmitter = require('events');\nconst myEmitter = new EventEmitter();\n\nmyEmitter.on('data', (data) =&gt; {\nconsole.log(`Data received: ${data}`);\n});\n\nfunction retrieveData() {\n\/\/ simulate database query delay\nsetTimeout(() =&gt; {\nconst data = 'some data';\nmyEmitter.emit('data', data);\n}, 2000);\n}\n\nretrieveData();\nconsole.log('Request processed');<\/pre>\n<p>In the above example, we&#8217;re using an asynchronous event to retrieve data from a simulated database query. We&#8217;re emitting an event data with the<strong> data<\/strong> as an argument.<\/p>\n<p>The listener function then processes the data asynchronously, and the request continues to be processed without waiting for the data retrieval to complete.<\/p>\n<h3>Handling events only once:<\/h3>\n<p>In Node.js, events are a powerful tool for handling asynchronous code. However, sometimes you may only want to handle an event once, instead of multiple times. In this article, we will explore how to handle events only once using the once method in Node.js.<\/p>\n<p>The once method is a built-in method in Node.js that allows developers to listen for an event only once. After the event is emitted and handled, the listener is automatically removed, preventing it from being executed again.<\/p>\n<p>Here&#8217;s an example of how to handle events only once using the<strong> once<\/strong> method:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const EventEmitter = require('events');\nconst myEmitter = new EventEmitter();\n\nfunction handleEvent() {\nconsole.log('Event handled');\n}\n\nmyEmitter.once('my-event', handleEvent);\n\nmyEmitter.emit('my-event');\nmyEmitter.emit('my-event');<\/pre>\n<p>In the above example, we&#8217;re creating a new EventEmitter instance and adding a listener to the my-event event using the once method. We&#8217;re then emitting the event twice, but the listener function is only executed once.<\/p>\n<p>By using the once method, we can prevent the same event from being handled multiple times and avoid potential issues that can arise from multiple event listeners executing the same code.<\/p>\n<h3>Capture Rejections of Promises:<\/h3>\n<p>Promises are a powerful feature in Node.js, allowing developers to write asynchronous code that is easier to reason about and maintain. However, sometimes promises can fail, resulting in errors or rejections. In this article, we will explore how to capture rejections of promises using events in Node.js.<\/p>\n<p>In Node.js, the <strong>\u2018unhandledRejection\u2019<\/strong> event is emitted when a promise rejection is not caught. Developers can listen for this event to handle uncaught promise rejections and prevent them from crashing the application.<br \/>\nHere&#8217;s an example of how to capture rejections of promises using the <strong>\u2018unhandledRejection\u2019<\/strong> event:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">process.on('unhandledRejection', (reason, promise) =&gt; {\nconsole.log('Unhandled Rejection at:', promise, 'reason:', reason);\n});\n\nconst promise = new Promise((resolve, reject) =&gt; {\nreject(new Error('Something went wrong'));\n});\n\npromise.catch((err) =&gt; {\nconsole.error(err);\n});<\/pre>\n<p>In the above example, we&#8217;re creating a new promise and rejecting it with an error. We&#8217;re then using the<strong> \u2018catch\u2019<\/strong> method to handle the rejection and logging the error to the console. Additionally, we&#8217;re listening for the<strong> \u2018unhandledRejection\u2019<\/strong> event using the <strong>\u2018process\u2019<\/strong> object and logging the unhandled rejection and the reason for it.<\/p>\n<p>By listening for the <strong>\u2018unhandledRejection\u2019<\/strong> event, developers can prevent uncaught promise rejections from crashing the application and handle them in a more graceful manner. This can help improve application reliability and prevent unexpected downtime.<\/p>\n<h3>Passing arguments and this to listeners<\/h3>\n<p>In Node.js, events are used to facilitate communication between different parts of an application. When an event is emitted, it triggers all the registered event listeners that are listening for that event. These listeners can receive arguments and the value of this based on how the event is emitted.<\/p>\n<p>Here&#8217;s how to pass arguments to event listeners in Node.js:<\/p>\n<p>1. Emit the event and pass the arguments as additional parameters to the &#8217;emit&#8217; method.<\/p>\n<p><strong>For example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const EventEmitter = require('events');\nconst myEmitter = new EventEmitter();\n\nmyEmitter.on('greeting',(name)=&gt;{\n    console.log('Hello,${name}!');\n});\n\nmyEmitter.emit('greeting','John');<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">&#8216;Hello, John!&#8217;<\/div>\n<p>In the above code, the &#8216;greeting&#8217; event is emitted with the &#8216;name&#8217; argument &#8216;John&#8217;. The event listener for &#8216;greeting&#8217; receives the &#8216;name&#8217; argument as its parameter.<\/p>\n<p>Here&#8217;s how to set the value of &#8216;this&#8217; in event listeners in Node.js:<\/p>\n<p>2. Use the bind method to &#8216;bind&#8217; a specific value to &#8216;this&#8217; when registering the event listener.<\/p>\n<p><strong>For example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const EventEmitter = require('events');\nconst myEmitter = new EventEmitter();\n\nconst myObj={\n    name:'John',\n    greet(){\n      console.log('Hello,${this.name}!');\n    },\n};\nmyEmitter.on('greeting',myObj.great.bind(myObj)));\n\nmyEmitter.emit('greeting');<\/pre>\n<p><strong>Output: <\/strong><\/p>\n<div class=\"code-output\">&#8216;Hello, John!&#8217;<\/div>\n<p>In the above code, the &#8216;greet&#8217; method of &#8216;myObj&#8217; is bound to &#8216;myObj&#8217; using the &#8216;bind&#8217; method. When the &#8216;greeting&#8217; event is emitted, the bound &#8216;greet&#8217; method is called with &#8216;myObj&#8217; as its &#8216;this&#8217; value.<\/p>\n<h3>Conclusion:<\/h3>\n<p>Events are a powerful and flexible feature of Node.js that can be used to create dynamic and responsive applications. Whether you&#8217;re building a small application or a large-scale enterprise system, events can help you create more efficient and maintainable code. By understanding the \u2018EventEmitter\u2019 class and how to use events in your application, you&#8217;ll be well on your way to becoming a proficient Node.js developer.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Node.js is an event-driven programming language that is particularly good at handling asynchronous tasks. One of the key features of Node.js is its event system, which allows you to respond to events and trigger&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":87565,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4984],"tags":[4993,4994],"class_list":["post-87563","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-node-js-tutorials","tag-events-in-nodejs","tag-nodejs-event-system"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Events in Nodejs - TechVidvan<\/title>\n<meta name=\"description\" content=\"Learn about events in Node.js and how they can be used to create dynamic and responsive applications with examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Events in Nodejs - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Learn about events in Node.js and how they can be used to create dynamic and responsive applications with examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-26T04:22:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2023\/04\/node-js-events.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Events in Nodejs - TechVidvan","description":"Learn about events in Node.js and how they can be used to create dynamic and responsive applications with examples.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/","og_locale":"en_US","og_type":"article","og_title":"Events in Nodejs - TechVidvan","og_description":"Learn about events in Node.js and how they can be used to create dynamic and responsive applications with examples.","og_url":"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2023-05-26T04:22:50+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2023\/04\/node-js-events.webp","type":"image\/webp"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Events in Nodejs","datePublished":"2023-05-26T04:22:50+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/"},"wordCount":1590,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2023\/04\/node-js-events.webp","keywords":["events in nodejs","nodejs event system"],"articleSection":["Node Js Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/","url":"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/","name":"Events in Nodejs - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2023\/04\/node-js-events.webp","datePublished":"2023-05-26T04:22:50+00:00","description":"Learn about events in Node.js and how they can be used to create dynamic and responsive applications with examples.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2023\/04\/node-js-events.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2023\/04\/node-js-events.webp","width":1200,"height":628,"caption":"node js events"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/events-in-nodejs\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Events in Nodejs"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/87563","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=87563"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/87563\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/87565"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=87563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=87563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=87563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}