Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
This directory provides only backends that run on the server for
*non-Python* languages. Look in ../v5-unity/ for the Python Tutor
frontend code and the Python execution backend.

---
Release notes:

2015-01-24 - This is an experimental version of OPT that adds support
for multiple target languages under one unified app. It relies on
Node.js for the server and docker for sandboxing.

---
Instructions:

To install node dependencies, run 'make deps'
(also depends on jshint and forever being globally-installed)

To start up the backend server, run 'make'

Note that this is really really really hard-coded for my own server
setup, so it will likely be hard for you to reproduce that setup.

You will also need to install and configure Docker to run the individual
backends in backends/ -- see Makefile and Dockerfile in each respective
directory.

Once you start up the cokapi.js Node.js server, you can ping it with
HTTP/HTTPS endpoints such as:

  /exec_java
  /exec_java_jsonp

to run various language backends, passing arguments in via GET
parameters. Each set of endpoints comes in a pair that returns either
regular JSON data (e.g., /exec_java) or JSONP (e.g., /exec_java_jsonp)
for cross-domain AJAX.


How does the OPT web frontend call this backend? Look at variables such
as langSettingToJsonpEndpoint in ../v5-unity/js/opt-frontend-common.ts
to see how the frontend calls the backends via JSONP using jQuery code
such as:

        // the REAL call uses JSONP
        // http://learn.jquery.com/ajax/working-with-jsonp/
        $.ajax({
          url: jsonp_endpoint,
          // The name of the callback parameter, as specified by the YQL service
          jsonp: "callback",
          dataType: "jsonp",
          data: {user_script : codeToExec,
                 options_json: JSON.stringify(backendOptionsObj)},
          success: callbackWrapper,
        });