Skip to content
This repository has been archived by the owner on Jan 4, 2018. It is now read-only.

thinxer/jsonapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A KISS WSGI application built to make pure AJAX application easier.

Example server code:

# server.py
from jsonapp import DefaultWebApplication, serve

application = DefaultWebApplication()
api = application.jsonapp.decorator()

@api
def hello(name):
    return { "hello":name }

serve(application, "127.0.0.1", 8080)

Example JavaScript client code:

// include the script '/_client.js' first.
var r = new JsonRemote("/api");
r.call("hello", ["JsonApp"], function(err, d) {
    if (err) {
        document.write(JSON.stringify(err));
    } else {
        document.write(JSON.stringify(d));
    }
});

Example Python client code:

from jsonapp import Remote
r = Remote('http://localhost:8080/api')
r.hello('world')

The r object is tab-completable in IPython, which is quite handy.

The entire framework is designed to be easy to use, and no easier. To speed up development, it also comes with a static file server. Drop your static files into static directory and your app is up and running. index.html will be automatically mapped to the root path /.

About

A simple python javascript bridge framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published