Skip to content
Snippets Groups Projects
Commit c2e812ad authored by stevereis's avatar stevereis
Browse files

Added get experiments

parent 2df83aaf
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,10 @@ import { IEngineOptions, IEngineService } from "src/engine/engine.interfaces";
export default class DataShieldService implements IEngineService {
constructor(private readonly options: IEngineOptions, private readonly httpService: HttpService) { }
getExperiments(): Observable<string> {
throw new Error("Method not implemented.");
}
getAlgorithms(): Observable<string> {
throw new Error("Method not implemented.");
......
......@@ -5,6 +5,14 @@ import { IEngineOptions, IEngineService } from "src/engine/engine.interfaces";
export default class ExaremeService implements IEngineService {
constructor(private readonly options: IEngineOptions, private readonly httpService: HttpService) { }
getExperiments(): Observable<string> {
const path = this.options.baseurl + "experiments";
return this.httpService.get<string>(path).pipe(
map(response => response.data)
);
}
getAlgorithms(): Observable<string> {
const path = this.options.baseurl + "algorithms";
......
import { HttpService } from '@nestjs/axios';
import { Controller, Get, Inject } from '@nestjs/common';
import { Controller, Get, Inject, Req } from '@nestjs/common';
import { Request } from 'express';
import { Observable } from 'rxjs';
import { ENGINE_SERVICE } from './engine.constants';
import { IEngineService } from './engine.interfaces';
@Controller()
export class EngineController {
constructor(@Inject(ENGINE_SERVICE) private readonly engineService: IEngineService, private readonly httpService: HttpService) { }
constructor(@Inject(ENGINE_SERVICE) private readonly engineService: IEngineService) { }
@Get("/test")
getTest(): string {
......@@ -14,7 +15,13 @@ export class EngineController {
}
@Get('/algorithms')
getAlgorithms(): Observable<string> {
return this.engineService.getAlgorithms();
getAlgorithms(@Req() request: Request): Observable<string> {
return this.engineService.getAlgorithms(request);
}
@Get('/experiments')
getExperiments(@Req() request: Request): Observable<string> {
return this.engineService.getExperiments(request);
}
}
import { Request } from "express";
import { Observable } from "rxjs";
export interface IEngineOptions {
......@@ -8,5 +9,7 @@ export interface IEngineOptions {
export interface IEngineService {
demo(): string;
getAlgorithms(): Observable<string>;
getAlgorithms(request: Request): Observable<string>;
getExperiments(request: Request): Observable<string>;
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment