const http = require('http') const url = require('url'); function json_response(code, object, reponse) { reponse.statusCode = 200; res.setHeader('content-type', 'Application/json'); JSON.stringify(object); res.end(); } const server = http.createServer(function (request, response) { parsedUrl = url.parse(request.url, true); if(request.url === "/") { json_response(200,{status : "active"},response); } else if(request.url.startsWith("/info")) { console.log(parsedUrl); console.log(request.method); response.statusCode = 200; response.end('done'); } else { response.statusCode = 404; response.end('nothing'); } }); server.listen(8082);