Write a program in Javascript and/or HTML witch does the following. A successful project will have at minimum four phases in code execution:
When a end user visits the home page, your server send them a form to fill out.
When a end user submits the form, use the captured data to send the first API request.
Upon receiving the response from the first API request, your server will parse the response and generate a request to the second API.
You have to be careful here: the user cannot be the driver of this secondary request, if they have to interact with the page at all, (for example clicking a button) this is considered two separate requests and not two synchronous requests. In the GitHub Jobs x Todoist mashup upon receiving a response from GitHub our application immediate contacts Todoist for the next phase.
Upon receiving the response from the second API request, your server will parse the response and finally send results back to the end user.
You must use two APIs from this site.
https://github.com/public-apis/public-apisYou must make use of the following code to create a server.
const HTTP = require ("http");
const port = 3000;
const server = http.createServer();
server.on("request", request_handler);
function request_handler (req, res){
console.log ('New Request from $(req.socket.remoteAddress} for ${req.url}');
res.writeload (200, "OK", {'Content-Type':'text/html'});
res.write('Hello World');
res.end();
}
server.on("listening", listen_handler);
function listen_handler (){
console.log ('Now Listening on Port ${port}')
}
server.listen(port);