Skip to content

Instantly share code, notes, and snippets.

@grant grant/index.js
Last active Aug 27, 2019

Embed
What would you like to do?
Express Routing: Switch (2)
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
You can’t perform that action at this time.