Skip to content

Instantly share code, notes, and snippets.

@danscan
Created January 25, 2016 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danscan/dd77cae24fac6fe322fa to your computer and use it in GitHub Desktop.
Save danscan/dd77cae24fac6fe322fa to your computer and use it in GitHub Desktop.
Policy function
const db = {
usersBySessionToken: {
'1': {
id: 1,
name: 'Dan',
},
},
postsById: {
'2': {
id: 2,
author: 1,
body: 'hey',
},
},
getRequestUser(sessionToken) {
return this.usersBySessionToken[sessionToken];
},
getPost(postId) {
return this.postsById[postId];
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment