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

Added API call for algorithms (Exareme)

parent 45423b0f
No related branches found
No related tags found
No related merge requests found
import { HttpService } from "@nestjs/axios";
import { Observable } from "rxjs";
import { IEngineOptions, IEngineService } from "src/engine/engine.interfaces";
export default class DataShieldService implements IEngineService {
constructor(private readonly options: IEngineOptions, private readonly httpService: HttpService) { }
getAlgorithms(): Observable<string> {
throw new Error("Method not implemented.");
}
demo(): string {
return "datashield";
}
......
import { HttpService } from "@nestjs/axios";
import { map, Observable } from "rxjs";
import { IEngineOptions, IEngineService } from "src/engine/engine.interfaces";
export default class ExaremeService implements IEngineService {
constructor(private readonly options: IEngineOptions, private readonly httpService: HttpService) { }
getAlgorithms(): Observable<string> {
const path = this.options.baseurl + "algorithms";
return this.httpService.get<string>(path).pipe(
map(response => response.data)
);
}
demo(): string {
return "exareme"
}
......
import { HttpService } from '@nestjs/axios';
import { Controller, Get, Inject } from '@nestjs/common';
import { Observable } from 'rxjs';
import { ENGINE_SERVICE } from './engine.constants';
import { IEngineService } from './engine.interfaces';
......@@ -11,4 +12,9 @@ export class EngineController {
getTest(): string {
return this.engineService.demo();
}
@Get('/algorithms')
getAlgorithms(): Observable<string> {
return this.engineService.getAlgorithms();
}
}
import { Observable } from "rxjs";
export interface IEngineOptions {
type: string;
baseurl: string;
}
export interface IEngineService {
demo(): string;
getAlgorithms(): 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