Examples

NodeRunner comes with a number of examples to show how to best make use of its apis. If you feel that some part of the application is missing examples feel free to submit pull requests including new ones.

Calling the CoffeeScript compiler

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
"""Example showing how to use coffeescript with noderunner
"""
from noderunner import Client

code = """test_fn = -> console.log('foo')"""


def main():
    cli = Client()

    ctx = cli.context("example", [("cs", "coffee-script")])

    res = ctx.call("cs", "compile", (code,))

    print(res)


if __name__ == "__main__":
    main()