Skip to content

Instantly share code, notes, and snippets.

@elierotenberg
Last active August 29, 2015 14:15
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 elierotenberg/6c9e08c156ecc021687b to your computer and use it in GitHub Desktop.
Save elierotenberg/6c9e08c156ecc021687b to your computer and use it in GitHub Desktop.
Flux over the Wire server.js
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