Projekt

Obecné

Profil

« Předchozí | Další » 

Revize efc2257b

Přidáno uživatelem castic96 před více než 4 roky(ů)

Re #7658: Integrace frontendu a backendu
- upraven Dockerfile v backendu, aby prováděl build v Dockeru
- přidána konstanta httpOptions, úprava dle code conventions

Zobrazit rozdíly:

.gitignore
3 3
be/*.iml
4 4
be/fulltextsearch/*.iml
5 5
fe/*.iml
6
fe/fulltextsearch/node_modules/
6 7

  
7 8
# Build files
8 9
target/
be/fulltextsearch/Dockerfile
1
### STAGE 1: RUN ###
1
### STAGE 1: BUILD ###
2
FROM maven:3.6.3-jdk-11-slim AS build
3
RUN mkdir -p /workspace
4
WORKDIR /workspace
5
COPY pom.xml /workspace
6
COPY src /workspace/src
7
RUN mvn -f pom.xml clean package
8

  
9
### STAGE 2: RUN ###
2 10
FROM adoptopenjdk:11-jre-hotspot
3
RUN mkdir /opt/app
4
COPY target/fulltextsearch-0.0.1-SNAPSHOT.jar /opt/app
5
CMD ["java", "-jar", "/opt/app/fulltextsearch-0.0.1-SNAPSHOT.jar"]
11
COPY --from=build /workspace/target/*.jar app.jar
12
EXPOSE 8080
13
ENTRYPOINT ["java","-jar","app.jar"]
fe/fulltextsearch/src/app/services/query.service.ts
1 1
import { Injectable } from '@angular/core';
2
import { HttpClient } from '@angular/common/http';
3
import {Observable} from 'rxjs';
2
import { HttpClient, HttpHeaders } from '@angular/common/http';
3
import { Observable } from 'rxjs';
4 4
import { QueryResponse } from '../model/QueryResponse';
5
import {Query} from '../model/Query';
5
import { Query } from '../model/Query';
6

  
7
const httpOptions = {
8
  headers: new HttpHeaders( {
9
    'Content-Type': 'application/json'
10
  })
11
};
6 12

  
7 13
@Injectable({
8 14
  providedIn: 'root'
9 15
})
10 16
export class QueryService {
11 17

  
12
  backendUrl = 'http://localhost:8080/';
13

  
18
  backendUrl: string = 'http://localhost:8080/';
14 19

  
15
  constructor( private httpClient: HttpClient) {}
20
  constructor(private httpClient: HttpClient) {}
16 21

  
17 22
  sendQuery(query: Query): Observable<QueryResponse> {
18
    return this.httpClient.post<QueryResponse>(this.backendUrl, query);
23
    return this.httpClient.post<QueryResponse>(this.backendUrl, query, httpOptions);
19 24
  }
20 25
}

Také k dispozici: Unified diff