From b5a93c7ef4d872dd629edbd73a51bf38c2f09bc0 Mon Sep 17 00:00:00 2001 From: ogbon Date: Sat, 18 Nov 2023 05:16:55 +0100 Subject: [PATCH] add Event assignment as told --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 79a6b67..1a69296 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,21 @@ # -100daysofEngineering- Repo for Mastering Backend BootCamp and #100daysOfEngineering +# Event In NodeJs + +Virtually everything in NodeJs is event driven, And even when a server is +created using NodeJs there is an event listener passed into the server that +keeps listener for request on the port associated with the server. There is +even something also called Event Loop in NodeJs which is very instrumental +to how NodeJs works. + +Node.js has a built-in module, called "Events", where you can create-, fire-, +and listen for- your own events.To include the built-in Events module the +require() method can be used. In addition, all event properties and methods +are an instance of an EventEmitter object. To be able to access these properties +and methods, create an EventEmitter object. + +The main methods associated with the Event object are the on(), emit(). +The on() method is used to create an event listener usually consisting +of a callback function and the emit() method is used to trigger an event. +