import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root',
})
export class CodeExecutionService {
  private apiUrl = 'http://localhost:3000'; // Url du serveur Node.js en local

  constructor(private http: HttpClient) {}

  executeCode(code: string): Observable<any> {
    return this.http.post<any>(this.apiUrl, { code });
  }
}