Question: I NEED THE ANSWER IN 20MIN. PLEASE HELP ASAP! I WILL GIVE THUMBS UP , Thank you! Question1 Show the complete code for a functioning
I NEED THE ANSWER IN 20MIN. PLEASE HELP ASAP! I WILL GIVE THUMBS UP, Thank you!
Question1
Show the complete code for a functioning server.js file that defines a single route that listens to HTTP GET requests on the /about url (ie: http://localhost:8080/about) and responds by sending the "aboutUs.html" file located within a views folder in the same directory as the "server.js" file (ie ./views)
Question2
Show the code for a module called "adder" that stores a single integer value (ie, "total" defaulted to 0) and exposes the following 3 functions: (NOTE: You may assume that you're writing your module inside a separate "adder.js" file)
- addNum(num) This function adds the value of "num" to "total" (declared inside the module)
- getTotal() This function returns the value of "total"
- resetTotal() This function resets the value of "total" by setting it back to 0
Usage Example: adderModule.addNum(5); adderModule.addNum(4); console.log(adderModule.getTotal()); // outputs 9 adderModule.resetTotal(); console.log(adderModule.getTotal()); // outputs 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
