Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danimydev/code-runner-api
Rest API that runs your code in containers and provide stdout and stderr
https://github.com/danimydev/code-runner-api
api code-runner deno docker
Last synced: 2 days ago
JSON representation
Rest API that runs your code in containers and provide stdout and stderr
- Host: GitHub
- URL: https://github.com/danimydev/code-runner-api
- Owner: danimydev
- License: mit
- Created: 2023-09-20T14:50:50.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-16T23:38:48.000Z (4 months ago)
- Last Synced: 2024-07-18T02:37:10.604Z (4 months ago)
- Topics: api, code-runner, deno, docker
- Language: TypeScript
- Homepage: https://github.com/danimydev/code-runner-api
- Size: 80.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# code-runner-api
A deno api for running code in different programming languages.
## Requirements
- [deno](https://deno.land/)
- [docker-desktop](https://www.docker.com/products/docker-desktop/)## Supported Languages
- [typescript](https://www.typescriptlang.org/)
- [javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript)
- [python](https://www.python.org/)
- [golang](https://go.dev/)## Run Locally
Clone the project
```bash
git clone https://github.com/thieves-guild/code-runner-api.git
```Go to the project directory
```bash
cd code-runner-api
```Start the server
```bash
# locally production
deno task start
``````bash
# locally development
deno task dev
``````bash
# container
docker-compose up --build
```## API Reference
#### Health check
```http
GET /healthHTTP/1.1 200 OK
```#### Get all supported languages
```http
GET /languagesHTTP/1.1 200 OK
Content-Type: application/json{
"languages": [
{
"name": "typescript",
"info": {
"enviromentCommand": "--version",
"executionCommand": "deno",
"executionArgs": [
"run"
],
"extension": "ts",
"websiteUrl": "https://www.typescriptlang.org/"
},
"enviroment": [
"deno 1.37.0 (release, x86_64-unknown-linux-gnu)",
"v8 11.8.172.3",
"typescript 5.2.2"
]
},
{
"name": "python3",
"info": {
"enviromentCommand": "--version",
"executionCommand": "python3",
"executionArgs": [],
"extension": "py",
"websiteUrl": "https://www.python.org/"
},
"enviroment": [
"Python 3.10.13"
]
}
],
"timeStampt": 1695563685183
}
```#### Get supported languages by name (unique)
```http
GET /languages/:languageNameHTTP/1.1 200 OK
Content-Type: application/json{
"name": "python3",
"info": {
"enviromentCommand": "--version",
"executionCommand": "python3",
"executionArgs": [],
"extension": "py",
"websiteUrl": "https://www.python.org/"
},
"enviroment": [
"Python 3.10.13"
],
"timeStampt": 1695563724530
}
```#### Run code
```http
POST /code
Content-Type: application/json{
"language": "typescript",
"code": "console.log('hello world');"
}HTTP/1.1 201 OK
Content-Type: application/json{
"languague": "typescript",
"code": 0,
"stdout": "hello world\n",
"stderr": "",
"timeStampt": 1695563805981
}
```