Last active
August 29, 2015 14:15
-
-
Save elierotenberg/6c9e08c156ecc021687b to your computer and use it in GitHub Desktop.
Flux over the Wire server.js
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
const server = new FluxServer(8080); | |
const messageList = server.Store('/messageList'); | |
messageList.set('nextId', 0).commit(); | |
const postMessage = server.Action('/postMessage') | |
.onDispatch(({ nickname, message }) => { | |
messageList.set(messageList.get('nextId') + 1, { nickname, message }) | |
.set('nextId', messageList.get('nextId') + 1) | |
.commit() | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment