Skip to content

Commit fd1454f

Browse files
committed
added simple-execute to the docs
1 parent dd6d041 commit fd1454f

1 file changed

Lines changed: 26 additions & 16 deletions

File tree

README.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ContainerizationAPI
22

3-
The general idea of this project is to provide a service similar to the [CodeExecutionAPI](https://github.com/thealcodingclub/CodeExecutionAPI) by [The Alcoding Club](github.com/thealcodingclub) but to manually implement the containerization using cgroups, namespaces, chroot and a bunch of other unix/linux utility tools.
3+
The general idea of this project is to provide a service similar to the [CodeExecutionAPI](https://github.com/thealcodingclub/CodeExecutionAPI) by [The Alcoding Club](github.com/thealcodingclub) but to manually implement the containerization using cgroups, namespaces, chroot and a bunch of other unix/linux utility tools. This will help accomplish faster execution times and cut down on sandboxing overhead
44

55
I'm making this as part of a bigger project to host my own coding contests on a platform a little better than hackerrank. The Alcoding Club's API is fine but I need one thats more efficient and has less overhead than firejail.
66

@@ -11,16 +11,19 @@ To **Host** this API, you need to have Linux or WSL (if you're on windows) or Ma
1111

1212
## Usage
1313

14-
Just send an HTTP request to the `/execute` endpoint (sample requests with sample curl commands given below),
15-
If you've already used [CodeExecutionAPI](https://github.com/thealcodingclub/CodeExecutionAPI), this is basically a drop-in replacement for that project
14+
Using this API is designed to be as simple as possible, at it's core, it's just an HTTP request that you send to `/execute`, or `/simple-execute`
1615

17-
### Route: /execute
16+
The following are the routes that this API makes available, click one to see it's documentation
17+
18+
<details>
19+
<summary><h3>POST Route: /simple-execute</h3></summary>
20+
21+
This route is a drop in replacement for [CodeExecutionAPI](https://github.com/thealcodingclub/CodeExecutionAPI), just take the code where you called the old API and replace `https://codeapi.anga.codes/execute` with `${url}/simple-execute` and watch as ur response times get faster!.
1822

1923
This route takes 4 fields:
2024

2125
1. `langauge`: The language of the code snippet.
22-
23-
<details>
26+
<details>
2427
<summary>Click to see supported languages</summary>
2528

2629
- python
@@ -29,22 +32,20 @@ This route takes 4 fields:
2932
- c
3033
- java
3134

32-
</details>
35+
</details>
3336

3437
2. `code`: The code snippet to be executed.
35-
3. `timeout`: The maximum time in seconds for which the code should run. If the code runs for more than this time, it will be terminated.
36-
- default: **5 seconds**
37-
- max: **60 seconds**
38-
4. `max_memory`: The maximum memory in KB (kilobytes) that the code can use. If your code tries to use more memory than this, it'll encounter a memory limit error.
39-
- default: **32768KB** (or 32MB)
40-
- max: **131072KB** (or 128MB)
38+
3. `timeout` (optional field): The maximum number of seconds for which the code should run. If the code takes more time to execute than what it was allocated, it will be terminated.
39+
- default (value assumed if you dont specify): **5 seconds**
40+
- max (you can't allocate more seconds than this): **60 seconds**
41+
4. `max_memory`: The maximum memory in KB (kilobytes) that the code can use. If the code uses more memory than this, it will be terminated.
42+
- default (value assumed if you dont specify): **32768KB** (or 32MB)
43+
- max (you can't allocate more RAM than this): **131072KB** (or 128MB)
4144

42-
**Note:** The default and maximum values apply to the publically hosted URL of this repository, but if you are hosting your own instance, you can change the default and max values with environment variables (mentioned at the end of this README)
45+
*Note: the above mentioned default and max values can be modified by editing the environment variables mentioned at the bottom of this README*
4346

4447
---
4548

46-
### Example Requests
47-
4849
#### Request body format (Example 1):
4950

5051
```json
@@ -198,6 +199,15 @@ curl --location 'https://codeapi.anga.codes/execute' \
198199
}
199200
```
200201

202+
203+
</details>
204+
205+
**Note**: the route `/simple-execute` also calls `/execute` under the hood, its just that the formatting for the input and output are slightly more easy to read and understand.
206+
<details>
207+
<summary><h3>POST Route: /execute</h3></summary>
208+
Will type this out soon
209+
</details>
210+
201211
## Environment Variables
202212

203213
- `MAX_TIMEOUT`: This is the maximum timeout that a request can set, if an incoming request has a higher timeout than the value you set here, then it will ignore the request's set timeout only be executed for `MAX_TIMEOUT` time.

0 commit comments

Comments
 (0)