The code has listen function with port and callback function as argument. First it checking that the type of port if the number is type then again checking for the method either is GET OR POST methid. Based on that it emitting the event with httpGetRequest or httpPostRequest.
Else it making req parameters null. And if the type of port is number then it getting to listen on that port.
Here you may get confused with arrow function, callback function , eventEmitter.
As you are new to web developer first learn the basics of web and try to read official documentation from the source. Don’t copy and paste code from internet and check that are running or not. This will never help you to get improve the quality of your knowledge.
0
solved How to understand how this Node code works? [closed]