Skip to content

Commit 8599067

Browse files
committed
added exec_ts and exec_ts_jsonp endpoints
1 parent 88e4f5a commit 8599067

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎v4-cokapi/cokapi.js‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,13 @@ app.get('/exec_py3', function(req, res) {
111111
executePython('py3', req, res);
112112
});
113113

114-
app.get('/exec_js', exec_js_handler.bind(null, false));
115-
app.get('/exec_js_jsonp', exec_js_handler.bind(null, true));
114+
app.get('/exec_js', exec_js_handler.bind(null, false, false));
115+
app.get('/exec_js_jsonp', exec_js_handler.bind(null, true, false));
116116

117-
function exec_js_handler(useJSONP /* use bind first */, req, res) {
117+
app.get('/exec_ts', exec_js_handler.bind(null, false, true));
118+
app.get('/exec_ts_jsonp', exec_js_handler.bind(null, true, true));
119+
120+
function exec_js_handler(useJSONP /* use bind first */, isTypescript /* use bind first */, req, res) {
118121
var usrCod = req.query.user_script;
119122

120123
var exeFile;
@@ -133,6 +136,9 @@ function exec_js_handler(useJSONP /* use bind first */, req, res) {
133136
//args.push('--expose-debug-as=Debug',
134137
// 'backends/javascript/jslogger.js');
135138
}
139+
if (isTypescript) {
140+
args.push('--typescript=true');
141+
}
136142
args.push('--jsondump=true');
137143
args.push('--code=' + usrCod);
138144

0 commit comments

Comments
 (0)