let getHandler = require("./getHandler");
let postHandler = require("./postHandler");
let deleteHandler = require("./deleteHandler");
module.exports = (req, res) => {
// some code
fs.readFile(filePath, (err, content) => {
if (err) {
// some code
}
let method = req.method;
switch (method) {
case "GET": {
getHandler(); break;
}
case "POST": {
postHandler(); break;
}
case "DELETE": {
deleteHandler(); break;
}
}
});
};
высокого CC
http.createServer((req, res) => {
// some code
}).listen(8080);