Code Monkey home page Code Monkey logo

golang-sse-todo's Introduction

golang server sent events (sse) todo example

This example was inspired by golang-html5-sse-example and TodoMVC. It uses knockout.js for the UI and mongodb for storage. It's a little different than the other TodoMVC examples in that it adds SSE capabilities to synchronize the todo list.

Up and Running

Install Dependencies

Install golang

Install git and bazaar

sudo apt-get install git bzr

Install mongodb

Install mgo, the mongodb driver for golang

mkdir -p ~/Go/vendor
export GOPATH=~/Go/vendor
go get gopkg.in/mgo.v2

Clone this repository to your local filesystem

git clone https://github.com/rwynn/golang-sse-todo.git

Start the Servers

Start the mongo server if it's not already running

sudo mongod -f /etc/mongodb.conf

Run the Go server (assumes that $GOPATH already includes ~/Go/vendor to find mgo)

cd /path/to/golang-sse-todo
export GOPATH=$GOPATH:`pwd`
go run todo.go

Create some Todos

Open 2 instances of your browser side by side (your browser should support html5 EventSource). Navigate each browser to http://localhost:9080/static/

Start typing todo items in one of the browser instances. The todo should be listed and dynamically updated in both browser instances. Pressing return/enter will allow you to start entering a new todo.

Stop the Go server by pressing Control-c in the terminal.

golang-sse-todo's People

Contributors

rwynn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.