Git Product home page Git Product logo

alamid-todo-example's Introduction

alamid Todo-MVC

alamid todo mvc

An implementation of the TodoMVC app based on alamid.

Usage

First of all git clone the todo-example

git clone git://github.com/peerigon/alamid-todo-example.git

Switch to the example folder

cd alamid-todo-example

Install the dependencies

npm install

Then start the app

node app/init.server.js

"Open app" in your browser (preferably Chrome, Firefox has CSS troubles)

Playing with alamid

Browser-console

We attached the Todo-model to the window-object so you can interact with it directly via console.

Some Examples:

var todo = new Todo();
todo.set("title", "your title here");
todo.get();
todo.validate(function onValidation(validation) { 
	console.log(validation.result);
});
todo.getId();
todo.save(function onSave(err, res) { 
    if(err) { throw err; }
    console.log(res);
});
todo.getId();
Todo.findById(1, function onFindById(err, todo) {
   if(err) { throw err; }
   console.log(todo.get());
});
Todo.find({}, function onFind(err, todos) {
	todos.each(function(todo) {
	    console.log(todo.get());
	});
});

Code-changes

You can change client-code (views, pages, client-services) on the fly. Simply reload to see the changes. If you are changing the server-service you have to restart the alamid-server.

Client-only-mode

We extended the TodoMVC example to use alamid's server-service. This way we can make it realtime and push changes to all connected clients. If you want to disable the server-service and create a client-only app, simply set the __useServerService attribute to false in /app/services/todo/TodoService.client.class.js

NOTE: The server-service stores the data directly in memory / the service itself. That's just to keep things simple in the example. Don't do this in production unlike you love memory-leaks ;)

Any issues?

Feel free to create issues if something wents wrong or feels crazy.

alamid-todo-example's People

Contributors

jhnns avatar meaku avatar topa 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.