This is a Node.js server that responds to a single route: GET /I/want/title
. This route expects a list of website addresses in query string format and returns the titles of these websites in HTML format.
-
Ensure you have Node.js and npm installed. Download and install them from nodejs.org.
-
Clone this repository and navigate into the project directory:
git clone https://github.com/hamzasial1911/web-title-server.git cd web-titles-server
-
Install the necessary packages:
npm install axios jsdom async rxjs
-
Create a file
server_callbacks.js
and add the provided code. -
Run the server:
node server_callbacks.js
-
Create a file
server_async.js
and add the provided code. -
Run the server:
node server_async.js
-
Create a file
server_promises.js
and add the provided code. -
Run the server:
node server_promises.js
-
Create a file
server_rxjs.js
and add the provided code. -
Run the server:
node server_rxjs.js
You can test the server by visiting the appropriate URL in your browser or using a tool like curl
or Postman. For example:
curl "http://localhost:3000/I/want/title?address=google.com&address=http://yahoo.com"