Pre-Requisits:-
[NOTE- ASSUMING Node-JS is already installed on your machine.]
The following modules are required to execute the Node-JS file(s):
- Express
- Cookie-Parser
- Request
- Async
Instructions:- Please follow the following instructions carefully to execute the file(s): Step 1- Execute the file named "Week_1_Tasks.js" by executing the following command- node Week_1_Tasks.js Step 2- Open up a browser and type the following in the address bar- 127.0.0.1:8080/
Step 2.1- Visit "127.0.0.1:8080/" for task 1 output. It will display "Hello World - Vrushabh".
Step 2.2- Visit "127.0.0.1:8080/authors" for task 2 output. This will fetch a list of authors and their posts and display a list of author names along with the total number of posts posted by them.
Step 2.3- Visit "127.0.0.1:8080/setCookie" for task 3 output. This will set a cookie.
Step 2.4- Visit "127.0.0.1:8080/getCookie" for task 4 output. This will display the cookie value.
NOTE- A Cookie MUST be set by visiting "/setCookie" to get the output otherwise the output will be "undefined".
Step 2.5- Visit "127.0.0.1:8080/robots.txt" for task 5 output. This will set the access denied status code and display the message "Access Denied."
Step 2.6- Visit "127.0.0.1:8080/html" and "127.0.0.1:8080/image" for task 6 output. The "/html" will render an HTML page and the "/image" will render an image.
Step 2.7- Visit "127.0.0.1:8080/input" for task 7 output. This will display a basic HTML form with two textboxes and a submit button. Enter some text in the textboxes and click on submit button. This will print the entered data onto the console as well as display it on the browser page.