Giter Club home page Giter Club logo

codex's Introduction

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!

codex's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.