Skip to content

Commit c6875af

Browse files
committed
added skeleton for cokapi.js
1 parent 95279e0 commit c6875af

4 files changed

Lines changed: 52 additions & 0 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
*.out_py3
33
*.pyc
44
*.pyo
5+
v4-cokapi/node_modules/

‎v4-cokapi/Makefile‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
all:
2+
jshint cokapi.js && node cokapi.js
3+
4+
deps:
5+
npm install jshint express

‎v4-cokapi/README‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
2015-01-24 - This is an experimental version of OPT that adds support
22
for multiple target languages under one unified app. It relies on node
33
for the server and docker for sandboxing (if available).
4+
5+
To install node dependencies, run 'make deps'

‎v4-cokapi/cokapi.js‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
3+
Online Python Tutor
4+
https://github.com/pgbovine/OnlinePythonTutor/
5+
6+
Copyright (C) Philip J. Guo (philip@pgbovine.net)
7+
8+
Permission is hereby granted, free of charge, to any person obtaining a
9+
copy of this software and associated documentation files (the
10+
"Software"), to deal in the Software without restriction, including
11+
without limitation the rights to use, copy, modify, merge, publish,
12+
distribute, sublicense, and/or sell copies of the Software, and to
13+
permit persons to whom the Software is furnished to do so, subject to
14+
the following conditions:
15+
16+
The above copyright notice and this permission notice shall be included
17+
in all copies or substantial portions of the Software.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26+
27+
*/
28+
29+
// This is a nodejs server based on express that serves the v4-cokapi/ app
30+
// To test locally, run 'make' and load http://localhost:3000/
31+
32+
33+
var express = require('express');
34+
var app = express();
35+
36+
app.get('/', function(req, res) {
37+
res.send('Hello World!');
38+
});
39+
40+
var server = app.listen(3000, function() {
41+
var host = server.address().address;
42+
var port = server.address().port;
43+
console.log('Example app listening at http://%s:%s', host, port);
44+
});

0 commit comments

Comments
 (0)