Last active
April 9, 2018 07:48
-
-
Save dbismut/ff372ec489ece2c5b688d2357d010462 to your computer and use it in GitHub Desktop.
Part 1 - Defining routes
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
import posts from './postData'; | |
export default [ | |
{ | |
name: 'home', | |
path: '/', | |
onActivate: () => | |
Promise.resolve({ | |
posts: posts.map(({ content, ...rest }) => rest) | |
}) | |
}, | |
{ | |
name: 'post', | |
path: '/post/:id', | |
onActivate: params => | |
Promise.resolve({ post: posts.find(({ id }) => id === params.id) }) | |
} | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment