fossunited / falcon

A service that execute code in any programming language in a sandboxed environment.
MIT License
42 stars 6 forks source link

Simplify the API for most common use case #12

Closed anandology closed 3 years ago

anandology commented 3 years ago

The most common use case of LiveCode is to execute some code and get the result back. Dealing with websockets is quite an overkill for that.

Provide an endpoint that accepts as POST request with the code and returns the output as response.

POST /livecode

{
    "runtime": "python",
    "code": "for i in range(5): print(i)"
}
---
200 OK
{
    "exit_status": 0,
    "output": "0\n1\n2\n3\n4\n"
}
anandology commented 3 years ago

Implemented this in a slightly different way:

POST /livecode

{
    "runtime": "python",
    "code": "for i in range(5): print(i)"
}
---
200 OK

0
1
2
3
4