Last active
August 27, 2019 17:09
-
-
Save grant/d7e7241204cb4bb116d50e66331c92c3 to your computer and use it in GitHub Desktop.
Express Routing: Switch (2)
This file contains 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
export function getAllUsers(req, res) { | |
// TODO: Get users from a database | |
res.send(['Alice', 'Bob']); | |
} | |
export function getUser(req, res) { | |
// TODO: Get user details | |
res.send({ name: 'Alice', location: 'LAX', }); | |
} | |
export function getDefault(req, res) { res.status(404).send('Bad URL'); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment