Last active
April 26, 2018 19:12
-
-
Save kazagkazag/7eba0b818c4b60116729135dd8a9e6b6 to your computer and use it in GitHub Desktop.
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
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