Last active
August 29, 2015 14:13
-
-
Save PavelDemyanenko/b9aa2e1cfd6a152ab3a8 to your computer and use it in GitHub Desktop.
Controller for routes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function index(res) { | |
console.log("Action index was called"); | |
res.writeHead(200, { | |
"Content-type": "text/plain" | |
}); | |
var users = { | |
user1: "Jack White", | |
user2: "Jack Black", | |
user3: "Jack Grey" | |
}; | |
for (user in users) { | |
console.log(users[user]); | |
res.write(users[user] + "\n"); | |
} | |
res.end(); | |
} | |
function show(res) { | |
console.log("Action show was called"); | |
res.writeHead(200, { | |
"Content-type": "text/plain" | |
}); | |
var users = { | |
user1: "Jack White", | |
user2: "Jack Black", | |
user3: "Jack Grey" | |
}; | |
res.write(users[user1]); | |
res.end(); | |
} | |
exports.index = index; | |
exports.show = show; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment