gyorgyf@0: var http = require('http'); gyorgyf@0: var fs = require('fs'); gyorgyf@0: gyorgyf@0: http.createServer(function (req, res) { gyorgyf@0: console.log(req.url); gyorgyf@0: gyorgyf@0: switch (req.url) { gyorgyf@0: case '/mood': gyorgyf@0: res.end("{status:'ok'}"); gyorgyf@0: res.writeHead(200, {'Content-Type': 'application/json'}); gyorgyf@0: break; mgeorgi@6: case '/colors.txt': mgeorgi@6: res.end(fs.readFileSync("colors.txt")); mgeorgi@6: res.writeHead(200, {'Content-Type': 'text/plain'}); mgeorgi@6: break; gyorgyf@0: case '/moods.csv': gyorgyf@0: res.end(fs.readFileSync("moods.csv")); gyorgyf@0: res.writeHead(200, {'Content-Type': 'text/plain'}); gyorgyf@0: break; gyorgyf@0: case '/app.js': gyorgyf@0: res.end(fs.readFileSync("app.js")); gyorgyf@0: res.writeHead(200, {'Content-Type': 'text/javascript'}); gyorgyf@0: break; gyorgyf@0: default: gyorgyf@0: res.end(fs.readFileSync("index.html")); gyorgyf@0: res.writeHead(404, {'Content-Type': 'text/plain'}); gyorgyf@0: } mgeorgi@18: }).listen(80, "0.0.0.0");