Skip to content

Commit 82a51bf

Browse files
committed
fix: update readme
1 parent e5cbdd9 commit 82a51bf

File tree

3 files changed

+57
-36
lines changed

3 files changed

+57
-36
lines changed

.DS_Store

0 Bytes
Binary file not shown.

README.md

Lines changed: 54 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CodeX API
22

3-
> This API is still in very early stages of development. So consider not using the API in production.
3+
> This API is still in very early stages of development. So consider not using the API in production since things might change in the future.
44
55
### Introducing the new CodeX API
66

@@ -38,20 +38,20 @@ More coming very soon!
3838
### NodeJS Example to Execute API Call?
3939

4040
```js
41-
var axios = require("axios");
42-
var qs = require("qs");
41+
var axios = require('axios');
42+
var qs = require('qs');
4343
var data = qs.stringify({
44-
code: "import java.util.Scanner;\npublic class MatSym {\n public static void main(String[]args) {\n Scanner in = new Scanner(System.in);\nSystem.out.println(in.nextLine());\nSystem.out.println(in.nextLine());\n }\n}",
45-
language: "java",
46-
input: "Hello\nWorld",
44+
'code': 'val = int(input("Enter your value: ")) + 5\nprint(val)',
45+
'language': 'py',
46+
'input': '7'
4747
});
4848
var config = {
49-
method: "post",
50-
url: "https://codex-api.herokuapp.com/",
51-
headers: {
52-
"Content-Type": "application/x-www-form-urlencoded",
53-
},
54-
data: data,
49+
method: 'post',
50+
url: 'https://api.codex.jaagrav.in',
51+
headers: {
52+
'Content-Type': 'application/x-www-form-urlencoded'
53+
},
54+
data : data
5555
};
5656

5757
axios(config)
@@ -69,11 +69,12 @@ The output is a JSON object comprising only one parameter that is the output.
6969

7070
```json
7171
{
72-
"success": true,
73-
"timestamp": "2022-05-26T19:59:08.014Z",
74-
"output": "Hello\nWorld\n",
75-
"language": "java",
76-
"version": "11.0.15"
72+
"timeStamp": 1672439982964,
73+
"status": 200,
74+
"output": "Enter your value: 12\n",
75+
"error": "",
76+
"language": "py",
77+
"info": "Python 3.6.9\n"
7778
}
7879
```
7980

@@ -84,24 +85,42 @@ The output is a JSON object comprising only one parameter that is the output.
8485
This endpoint allows you to list all languages supported and their versions.
8586

8687
```json
87-
[
88-
{
89-
"language": "java",
90-
"compilerVersion": "11.0.15"
91-
},
92-
{
93-
"language": "cpp",
94-
"compilerVersion": "11.2.0"
95-
},
96-
{
97-
"language": "py",
98-
"compilerVersion": "3.7.7"
99-
},
100-
{
101-
"language": "c",
102-
"compilerVersion": "11.2.0"
103-
}
104-
]
88+
{
89+
"timeStamp": 1672440064864,
90+
"status": 200,
91+
"supportedLanguages": [
92+
{
93+
"language": "java",
94+
"info": "openjdk 11.0.17 2022-10-18\nOpenJDK Runtime Environment (build 11.0.17+8-post-Ubuntu-1ubuntu218.04)\nOpenJDK 64-Bit Server VM (build 11.0.17+8-post-Ubuntu-1ubuntu218.04, mixed mode, sharing)\n"
95+
},
96+
{
97+
"language": "cpp",
98+
"info": "g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0\nCopyright (C) 2017 Free Software Foundation, Inc.\nThis is free software; see the source for copying conditions. There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
99+
},
100+
{
101+
"language": "py",
102+
"info": "Python 3.6.9\n"
103+
},
104+
{
105+
"language": "c",
106+
"info": "gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0\nCopyright (C) 2017 Free Software Foundation, Inc.\nThis is free software; see the source for copying conditions. There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
107+
},
108+
{
109+
"language": "js",
110+
"info": "v16.13.2\n"
111+
},
112+
{
113+
"language": "go",
114+
"info": "go version go1.10.4 linux/amd64\n"
115+
},
116+
{
117+
"language": "cs",
118+
"info": "Mono C# compiler version 4.6.2.0\n"
119+
}
120+
]
121+
}
105122
```
106123

124+
> This API is deployed on a free instance on [render](https://render.com/) so shoutout to render for providing a platform that helped bringing back the CodeX API after a long down time. Since I am using a free tier, the API might be slow sometimes, so please be patient while I try to fund this project.
125+
107126
Happy hacking!

src/run-code/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ const {info} = require("./info")
55

66
const {spawn} = require("child_process");
77

8-
async function runCode({language = "", code = "", input = "", timeout = 20}) {
8+
async function runCode({language = "", code = "", input = ""}) {
9+
const timeout = 30;
10+
911
if (code === "")
1012
throw {
1113
status: 400,

0 commit comments

Comments
 (0)