CodeX is an online compiler for various languages like Java, C++, Python, etc.
CodeX has a simple UI in order to store all your codes written in various languages easily at one place.
You can share the codes' links that you write with your friends without being worried about them making any changes. CodeX stores all your code details on your device, which means every code that you write will only be editable on the device where you write you code in. Every Code shares a key that only your device and CodeX's backend know, so don't fear about others making any changes. Although there are ways to hack into others code and make changes but that's for you to find out. Once you find it out simply create an issue reporting the bug.
No need to Sign In / Sign Up in order to execute and save your code. Every code automatically saves and updates in realtime so don't worry about losing it. It will always live in your computer unless you decide to clear your cache.
Here's how you can execute code in various languages on your own website for free (no, there's no fucking catch, it's literally free),
This endpoint allows you to execute your script and fetch output results.
Parameter | Description |
---|---|
"code" | Should contain the script that needs to be executed |
"language" | Language that the script is written in for example: java, cpp, etc. (Check language as a payload down below in next question) |
"input" | In case the script requires any kind of input for execution, leave empty if no input required |
Whichever language you might mention in the language field, it would be automatically executed with the latest version of it's compiler.
Languages | Language as a payload |
---|---|
C++ | cpp |
C | c |
C# | cs |
Java | java |
Python | py |
Ruby | rb |
Kotlin | kt |
Swift | swift |
Whenever taking inputs, make sure to take inputs from a textarea. This would allow the user to make multi-line inputs, in order to take multiple inputs, the user needs to input every value line by line individually in order for the backend to differentiate between multiple inputs.
var axios = require('axios');
var data = JSON.stringify({
"code":`public class program{
public static void main(String [] args){
System.out.println(5+5+6);
}
}`,
"language":"java",
"input":""
});
var config = {
method: 'post',
url: 'https://codexweb.netlify.app/.netlify/functions/enforceCode',
headers: {
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.log(error);
});
The output is a JSON object comprising only one parameter that is the output.
{
"output":"16\n"
}
This project will not accept any PRs, I will only respond to issues created. There's a few stuff/code that have not been shared for obvious reasons.
Happy hacking!