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
Artem Yankov
committed
Jun 16, 2012
1 parent
2f9ef75
commit e962a61
Showing
1 changed file
with
46 additions
and
2 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,2 +1,46 @@ | ||
nourl | ||
===== | ||
Nourl | ||
===== | ||
|
||
Nourl is a simple library that allows you to call models' methods on server from | ||
your javascript as if they were local. | ||
|
||
It consists of two parts: a simple ruby JSON-RPC server and javascript client. | ||
JS client automatically creates stubs for backend classes and methods you want to use and allows you to call | ||
them as if they were defined in javascript. | ||
|
||
..What? | ||
------- | ||
So, say, on your backend side you have a model `User` with the method `get`. | ||
|
||
class User | ||
def self.get(name) | ||
User.find_by_name(name) | ||
end | ||
end | ||
|
||
Now, from my client JS I want to be able to call user.get without making any API calls, | ||
creating controllers and dealing with RPC manually. I works just like this: | ||
|
||
user.get("John", function(result) { | ||
console.log(result); | ||
}) | ||
|
||
That's it. | ||
|
||
How to use it | ||
------------- | ||
|
||
`gem install nourl` | ||
|
||
`git clone https://github.com/yankov/nourl.git` | ||
|
||
Then you can run an example server.rb from example folder: | ||
|
||
`cd ./nourl/examples` | ||
`ruby -rubygems server.rb` | ||
|
||
|
||
|
||
|
||
|
||
|