Skip to content

Instantly share code, notes, and snippets.

@elierotenberg

elierotenberg/server.js

Last active Aug 29, 2015
Embed
What would you like to do?
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