Skip to content

Instantly share code, notes, and snippets.

@kazagkazag
Last active April 26, 2018 19:12
Show Gist options
  • Save kazagkazag/7eba0b818c4b60116729135dd8a9e6b6 to your computer and use it in GitHub Desktop.
Save kazagkazag/7eba0b818c4b60116729135dd8a9e6b6 to your computer and use it in GitHub Desktop.
server.post("/register", (request, response) => {
const userName = request.body.userName;
// we can use request data to trigger positive
// or negative response, whatever we need
if (userName === "invalid") {
response.send(400, {
message: "Invalid user name."
});
} else {
response.send(200);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment