Local Development
Local Development
Follow these instructions to set up the testing-api on your local machine. This guide assumes you are setting up the environment for development, testing, or integration purposes within the Supervised AI ecosystem.
Prerequisites
Before you begin, ensure you have the following installed:
- Git: For version control and cloning the repository.
- Python 3.9+ or Node.js 18+: (Depending on your specific runtime environment).
- Package Manager:
pip(for Python) ornpm/yarn(for Node.js). - Virtual Environment:
venvorcondais recommended to isolate dependencies.
Installation
-
Clone the Repository Start by cloning the repository to your local workspace:
git clone https://github.com/UditAkhourii/testing-api.git cd testing-api -
Set Up a Virtual Environment (Recommended) Create and activate a fresh environment to avoid dependency conflicts:
# For Python users python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate` -
Install Dependencies Install the required packages defined in the configuration files:
# If using Python (pip) pip install -r requirements.txt # If using Node.js (npm) npm install
Configuration
The API requires certain environment variables to interact with the Supervised AI platform components.
-
Create a
.envfile in the root directory:cp .env.example .env -
Open the
.envfile and configure the following parameters:PORT: The port on which the local server will run (default:8000).API_KEY: Your Supervised AI authentication key.DATABASE_URL: Connection string for your local database instance.DEBUG: Set toTruefor detailed error logging.
Running the API
Once the dependencies are installed and the environment is configured, you can launch the local development server.
Standard Start Command:
# For Python (Uvicorn/FastAPI)
uvicorn main:app --reload
# For Node.js
npm run dev
The server will typically be available at http://localhost:8000.
Verification
To verify that the API is running correctly, you can perform a health check using curl or your preferred API client:
curl http://localhost:8000/health
Expected Response:
{
"status": "active",
"version": "1.0.0",
"platform": "Supervised AI"
}
Common Troubleshooting
- Port Conflicts: If port
8000is already in use, update thePORTvariable in your.envfile. - Missing Dependencies: Ensure your virtual environment is activated before running the installation command.
- Permission Denied: On Unix-based systems, you may need to grant execution permissions to script files using
chmod +x <filename>.