Imagine a browser's address bar. You need to send a GET request to your HTTP server with this information in the following order:
animal - dog
color - black
name - pinky
And here is the server code:
http.createServer((request, response) => {
const requestQueries = url.parse(request.url).query.split('&');
const requestParams = Object.fromEntries(requestQueries.map((query) => query.split('=')));
response.writeHead(200, {'Content-Type': 'application/json'});
response.write(JSON.stringify(requestParams));
response.end();
}).listen({
port: 9999,
host: '192.168.1.3'
});Notice that you need to specify the full path, with a protocol, host address, and port.