Node.js - HTTP Module
Given this code snippet, what will be the response if the client requests '/api/data'?
const http = require('http');
const server = http.createServer((req, res) => {
switch(req.url) {
case '/api/data':
res.writeHead(200, {'Content-Type': 'application/json'});
res.end(JSON.stringify({data: 'info'}));
break;
default:
res.writeHead(404);
res.end('Not Found');
}
});
server.listen(3000);