Ex No: 8 | WEB CLIENT USING NODE.JS |
---|---|
Aim: | To implement a server that reads and sends a HTML page using node.js. |
Procedure | |
Step1: Install Node Package Manager (npm) in the system. | |
Step2: Initialize Node.js using "npm init -y" in the terminal. | |
Step3: Create a file client.js” to implement the server. | |
Step4: Include "http" module to request JSON data from the server "dummyjson.com" and read it. | |
Step6: Quotes from the JSON data is displayed in the Console. | |
Step7: Run the code using "node client.js". | |
Source Code | |
server.js
|
|
Result: | Thus node.js client is implemented to request JSON data from the server and display it. |