-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
pemrouz
committed
May 2, 2016
1 parent
00e0cb6
commit 9f4502c
Showing
1 changed file
with
61 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,67 @@ | ||
# Minimal Example | ||
# Quick Start | ||
|
||
This can be used as a generator template project, with no dependencies. | ||
|
||
# Run | ||
### Run | ||
|
||
``` | ||
npm i | ||
node index.js | ||
start http://localhost:5000 | ||
``` | ||
``` | ||
|
||
### Overview | ||
|
||
``` | ||
npm install rijs | ||
``` | ||
|
||
##### index.js | ||
```js | ||
var app = require('express')() | ||
, server = require('http').createServer(app) | ||
, ripple = require('rijs').default(server) | ||
|
||
ripple | ||
.resource('tweets', ['lorem', 'ipsum']) | ||
.resource('twitter-feed', function(d){ | ||
this.innerHTML = '<li>' + d.join('</li><li>') + '</li>' | ||
}) | ||
|
||
server.listen(4000) | ||
|
||
app.get('/', function(req, res){ | ||
res.render('index.jade') | ||
}) | ||
``` | ||
|
||
##### views/index.jade | ||
|
||
```jade | ||
doctype | ||
html | ||
head | ||
script(src='/ripple.min.js') | ||
body | ||
twitter-feed(data='tweets') | ||
``` | ||
|
||
##### Run the app | ||
|
||
```shell | ||
node index.js | ||
``` | ||
|
||
### Reactive Data | ||
|
||
Now open `localhost:4000` in two tabs and then try doing `push('new tweet!')(ripple('tweets'))` to add new data. | ||
|
||
 | ||
|
||
### Reactive Component (hot code push) | ||
|
||
Or you could [try changing the implementation](https://github.com/rijs/examples/tree/master/minimal-vanilla) of the renderer by switching `green` to `red`, and watch the component update without a refresh: | ||
|
||
 | ||
|
||
### More Examples | ||
|
||
You can also grab this demo by doing a `git clone` on the [vanilla example from the examples repo](https://github.com/rijs/examples) or explore the other examples. |