kevinchen1227 / CodeX

CodeX is an online compiler for various languages like Java, C++, Python, etc. Execute code in various languages on your own website for free with the CodeX API!!!

Home Page:https://codexweb.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CodeX is an online compiler for various languages like Java, C++, Python, etc.

CodeX Editor

CodeX has a simple UI in order to store all your codes written in various languages easily at one place.

CodeX Home

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.

Something special for other developers

Introducing the CodeX API,

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),

Execute Code and fetch output

POST /.netlify/functions/enforceCode

This endpoint allows you to execute your script and fetch output results.

What are the Input Parameters for execute api call?

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

What are the languages that are supported for execution?

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

What if I have multiple inputs?

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.

NodeJS Example to Execute API Call?

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);
});

Sample Output

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!

About

CodeX is an online compiler for various languages like Java, C++, Python, etc. Execute code in various languages on your own website for free with the CodeX API!!!

https://codexweb.netlify.app/


Languages

Language:JavaScript 90.4%Language:HTML 7.1%Language:CSS 2.4%