|
1 | 1 | 2015-01-24 - This is an experimental version of OPT that adds support |
2 | | -for multiple target languages under one unified app. It relies on node |
3 | | -for the server and docker for sandboxing (if available). |
| 2 | +for multiple target languages under one unified app. It relies on |
| 3 | +Node.js for the server and docker for sandboxing |
4 | 4 |
|
5 | 5 | To install node dependencies, run 'make deps' |
6 | 6 |
|
7 | 7 | --- |
| 8 | +This directory provides only backends. Look in ../v3/ for frontend code |
| 9 | + |
| 10 | +Once you start up the Node.js server, then you can ping it with |
| 11 | +HTTP/HTTPS endpoints such as: |
| 12 | + |
| 13 | + /exec_java |
| 14 | + /exec_java_jsonp |
| 15 | + |
| 16 | +to run various language backends, passing arguments in via GET |
| 17 | +parameters. Each set of endpoints comes in a pair that returns either |
| 18 | +regular JSON data (e.g., /exec_java) or JSONP (e.g., /exec_java_jsonp) |
| 19 | +for cross-domain AJAX. |
| 20 | + |
| 21 | + |
| 22 | +Look at variables such as JAVA_JSONP_ENDPOINT in |
| 23 | +../v3/js/opt-frontend-common.js to see how the frontend calls the |
| 24 | +backends via JSONP using jQuery code like: |
| 25 | + |
| 26 | + // the REAL call uses JSONP |
| 27 | + // http://learn.jquery.com/ajax/working-with-jsonp/ |
| 28 | + assert(jsonp_endpoint); |
| 29 | + $.ajax({ |
| 30 | + url: jsonp_endpoint, |
| 31 | + // The name of the callback parameter, as specified by the YQL service |
| 32 | + jsonp: "callback", |
| 33 | + dataType: "jsonp", |
| 34 | + data: {user_script : codeToExec, |
| 35 | + options_json: JSON.stringify(backendOptionsObj)}, |
| 36 | + success: execCallback, |
| 37 | + }); |
8 | 38 |
|
9 | | -This directory provides only backends. Look in ../v3/ for the frontend. |
|
0 commit comments