• Stars
    star
    115
  • Rank 299,758 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 2 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The new version of CodeX API with it's backend, a lot of you wanted me to make the backend opensource, now it's ready to receive contributions from you. Thanks for being patient, more languages coming soon, happy hacking!

CodeX API

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.

Introducing the new 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 /

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
Java java
Python py
C++ cpp
C c
GoLang go
C# cs
NodeJS js

More coming very soon!

NodeJS Example to Execute API Call?

var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
    'code': 'val = int(input("Enter your value: ")) + 5\nprint(val)',
    'language': 'py',
    'input': '7'
});
var config = {
    method: 'post',
    url: 'https://api.codex.jaagrav.in',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
    },
    data : data
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

Sample Output

The output is a JSON object comprising only one parameter that is the output.

{
  "timeStamp": 1672439982964,
  "status": 200,
  "output": "Enter your value: 12\n",
  "error": "",
  "language": "py",
  "info": "Python 3.6.9\n"
}

Since a lot of people had issues with executing the previous API from backend or serverless function, unlike the previous version of the API, this version of the API won't throw any Cross Origin errors so you can use this from the front end without any worries. Thank me later ;)

GET /list

This endpoint allows you to list all languages supported and their versions.

{
  "timeStamp": 1672440064864,
  "status": 200,
  "supportedLanguages": [
    {
      "language": "java",
      "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"
    },
    {
      "language": "cpp",
      "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"
    },
    {
      "language": "py",
      "info": "Python 3.6.9\n"
    },
    {
      "language": "c",
      "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"
    },
    {
      "language": "js",
      "info": "v16.13.2\n"
    },
    {
      "language": "go",
      "info": "go version go1.10.4 linux/amd64\n"
    },
    {
      "language": "cs",
      "info": "Mono C# compiler version 4.6.2.0\n"
    }
  ]
}

This API is deployed on a free instance on render 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.

Happy hacking!

More Repositories

1

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!!!
JavaScript
223
star
2

raycast-vehicle-engine

Drive your favorite 3D car in your threejs world just by uploading the GLTF Model and generating code all on the browser itself!
JavaScript
53
star
3

Roadster

3D drivable tesla roadster made with threejs and cannonjs, so it's got physics.
JavaScript
33
star
4

Xper

Xper is a realtime code editor where you can both write and save your code in realtime! Please make all the changes and pull requests in the changes/updates branch in order to contribute.
JavaScript
18
star
5

Jaagrav-v-1

My previous personal blog and portfolio written in React.
JavaScript
12
star
6

react-pretty-carousel

Easily add beautiful carousels to your website in no time!
JavaScript
8
star
7

IndiCov

JavaScript
7
star
8

CodePen-Clone

JavaScript
7
star
9

learning-threejs

All the projects I made while learning ThreeJS
6
star
10

trigo-car

JavaScript
6
star
11

Poler

Poler is a React based PWA where people can easily create polls and share it with their friends. The results get updated in real-time. It uses Firebase in order to register and count polls.
JavaScript
5
star
12

Snapshot

An online Camera that uses your camera to take images, which you can immediately edit with quick edit and also download on your device.
JavaScript
5
star
13

Cordion

Cordion is a web app created in order to help you create and edit notes. It features a built in text editor to store your notes in a more organized and attractive manner.
JavaScript
5
star
14

Responsive-WhatsApp-Clone

A working web based WhatsApp Clone with a responsive UI for one to one communication. Including Google Auth to verify users and avoid spam.
JavaScript
5
star
15

Jaagrav

JavaScript
4
star
16

Scissor

An online image compressor that runs locally on your browser to quickly compress your images effectively faster than many other online image compressors out there.
JavaScript
4
star
17

IPL-Discovery

A discovery page for IPL where the user can view data related to IPL, search for players, filter teams, get info regarding specific players.
JavaScript
3
star
18

Fragments

Fragments is a light weight code editor which supports multiple languages, store your code/snippets here for future use.
JavaScript
3
star
19

Stalk-Hub

HTML
3
star
20

IndiaCOVID-19Map

HTML
3
star
21

Arduino

This repository is a collection of Arduino Projects that I am proud of, if you are a visitor from YouTube, you can find the specific folder with the name of the Arduino Project you want to work on. I'll be adding more and all of my Arduino Projects right here.
C++
3
star
22

Calendar

Web calendar with quotes: https://jaagrav.github.io/Calendar/
HTML
3
star
23

20QUEENS

Java
2
star
24

NotSoFast

Python
2
star
25

Weber

A Realtime Web IDE that remembers your code even after closing your browser and runs completely locally.
JavaScript
2
star
26

Congrats

HTML
2
star
27

Bookmarks

Take a glance: https://jaagrav.github.io/Bookmarks/
HTML
2
star
28

EasyPeasyLemonSqueezy

Python
2
star
29

ToDo-List-Web-App-Mobile

Here you go, check out the app: https://jaagrav.github.io/ToDo-List-Web-App-Mobile/
HTML
2
star
30

Weather-Mobile-Web-App

The App: https://jaagrav.github.io/Weather-Mobile-Web-App/
HTML
2
star
31

Web-Calculator

HTML
2
star
32

Brador

Brador is a productivity app created in React in order to organize your day and tasks in a fluid interface with drag and drop support. This project is under development.
JavaScript
2
star
33

2DO-React-Native

React Native App for 2Do, a simple task manager app. Available on both iOS and Android.
JavaScript
2
star
34

Google-News-API

Is it good? https://jaagrav.github.io/Google-News-API/
HTML
2
star
35

Music-Player

Music Player
JavaScript
2
star
36

LCD-App

JavaScript
1
star
37

tap-tiles

JavaScript
1
star
38

MarkDownParser

Just a markdown parser
CSS
1
star
39

CISCE-Circular-Generator

JavaScript
1
star
40

Wave

JavaScript
1
star
41

ConverseChat

A Fun Chat App where you can see what your friend types even before he/she sends the text.
JavaScript
1
star
42

PawSpot

HTML
1
star
43

SQL-Editor

Run SQL online by visiting this website. You can also run SQL from your website using the API, to know more read the api docs down below.
JavaScript
1
star
44

2DO-Electron

Get 2Do for your PC: https://drive.google.com/file/d/1v77270ctI_8HF8SRg9OwTTqkOOgkJSVY/view?usp=sharing
JavaScript
1
star
45

SoundWave-Bars

HTML
1
star
46

TalkingTomWeb

CSS
1
star
47

react-pretty-carousel-demo

Easily add beautiful carousels to your website in no time!
JavaScript
1
star
48

AcoBot-Chat

CSS
1
star