An API server for LoIDE clients. This component acts as an intermediary between LoIDE clients and server-side executors. It handles incoming requests from clients, forwards them to the appropriate executors, and then send the responses back to the clients.
These instructions will get you a copy of the project up and running on your local machine.
To run LoIDE API Server you need to have Node.js and npm installed on your system. You can download and install Node.js from the official website.
If you want to use the server-side features of LoIDE, you need to have a server that can execute Logic programs. If you like it, you can use our PythonESE.
To install LoIDE API Server, first clone the repository using the following command:
git clone https://github.com/DeMaCS-UNICAL/LoIDE-API-Server.git
Navigate to the cloned repository directory and install the required dependencies with npm:
npm install
Now you can run the application in development or production mode.
In the project directory, you can run:
npm start
This will start the server and it will be immediately ready to receive requests.
This repository provides also Docker containerization for LoIDE API Server. Docker enables the encapsulation of the LoIDE API Module within a lightweight, portable container, ensuring smooth deployment across various environments.
Deploying the LoIDE API Server using Docker is straightforward:
Ensure Docker is installed on your system (refer to the official Docker documentation for installation instructions). Then, clone this repository using the following command:
git clone https://github.com/DeMaCS-UNICAL/LoIDE-API-Server.git
A Docker image is a package that contains all the necessary to run application and it's used to create Docker containers. To create one navigate to the cloned repository directory and build the Docker image using the provided Dockerfile:
docker build -t loide-api .
Once the Docker image is built, you can run a Docker container using the following command:
docker run -d --network host --mount type=bind,source=[your/path/to/config],target=/app/config loide-api
The --network host
option in the docker run command tells Docker to use the host network for the container. This means the container shares the same network stack as the host and can access network services running on the host directly.
The --mount type=bind, source=[your/path/to/config], target=/app/config
option is used to create a bind mount. A bind mount is a type of mount that allows you to map a host file or directory to a container file or directory (for more information refer to the official Docker documentation).
In this case we use mounts to provide the configuration file to the container.
The configuration files are JSON files containing the configuration of the LoIDE API Server. They must be placed in a directory on the host and the full path to this directory must be specified in the source option of the --mount option. The JSON schemas needs also to be in the same directory.
For examples on how to create or modify the configuration file refer to the next section. If no configuration file is provided the default configuration will be used.
This configuration file is used to set up the server ports and SSL certificate paths for the application.
This property is an object that specifies the ports for the HTTP and HTTPS servers.
This property is an object that specifies the paths to the SSL certificate and key for the HTTPS server.
key
: The path to the SSL key file. Here, it's not provided, which means the HTTPS server will not be started.cert
: The path to the SSL certificate file. Similarly, it's not provided here, so the HTTPS server will not be started.
This configuration file is used to define the programming languages, solvers, executors, and options supported by the application.
The configuration file is structured as a JSON object with a single property: languages
. This property is an array where each object represents a programming language.
Each language object has three properties:
name
is the display name of the language.value
is the value that represents the language.solvers
is an array of solver objects that are supported by the language.
Each solver object within a language has four properties:
name
is the display name of the solver.value
is the value that represents the solver.executors
is an array of executor objects that are supported by the solver.options
is an array of option objects that are supported by the solver.
Each executor object within a solver has six properties:
protocol
is the protocol used by the executor (e.g., "ws" for WebSocket).url
is the URL of the executor.name
is the display name of the executor.value
is the value that represents the executor.path
is the path on the executor's server.port
is the port on which the executor's server is listening.
Each option object within a solver has four properties:
name
is the display name of the option.value
is the value that represents the option.word_argument
is a boolean indicating whether the option requires an argument.description
is a description of the option.
We use Semantic Versioning for versioning. For the versions available, see the releases on this repository.
- Stefano Germano (Coordinator)
- Rocco Palermiti
- Marco Duca
From the Department of Mathematics and Computer Science of the University of Calabria
This project is licensed under the MIT License