This repository contains a simple backend for a Code API that allows you to execute code snippets in different programming languages. It supports PHP and Python languages.
To set up the Code API backend for local development, follow these steps:
- Clone the repository:
git clone https://github.com/its-working/code-api-backend.git
- Make sure you have PHP and Python installed on your local machine.
- Open the code in your preferred code editor.
The API endpoint for executing code snippets is POST /execute-code
.
The API expects a JSON payload with the following parameters:
code
: The code snippet to execute.language
: The programming language of the code snippet (either "PHP" or "PYTHON").
Example payload:
{
"code": "<?php echo 'Hello, World!'; ?>",
"language": "PHP"
}
If the code execution is successful, the API will respond with the output of the executed code. If there is an error during execution, the API will respond with an error message.
Example successful response:
{
"output": "Hello, World!"
}
Contributions are welcome! If you have any ideas, improvements, or bug fixes, please open an issue or submit a pull request.
This project is licensed under the MIT License.