Skip to content

Commit

Permalink
Api gateway and discovery server (#9)
Browse files Browse the repository at this point in the history
* api gate e disc serv

* trying adding discovery eapi gateway

* api-gateway cors e webapp

* fixed CORS settings for api geteway

* fixed date parsing

* unzip fucking works

* fixed web app

* fixed webapp

* fixed frontend

* fixed white spaces in zip file names

* handled evaluation requests when battle has not started yet more gracefully

---------

Co-authored-by: manuelamarenghi <[email protected]>
  • Loading branch information
SigCatta and manuelamarenghi committed Feb 4, 2024
1 parent 7f17929 commit e88bcce
Show file tree
Hide file tree
Showing 103 changed files with 3,889 additions and 48 deletions.
2 changes: 2 additions & 0 deletions code/account-manager/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM openjdk:21

ENV TZ=Europe/Rome

COPY target/*.jar account-manager-app.jar

ENTRYPOINT ["java","-jar","/account-manager-app.jar"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

@SpringBootApplication
@EnableDiscoveryClient
public class AccountManagerApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
@RequestMapping("/api/account/mail")
@Slf4j
@RequiredArgsConstructor
@CrossOrigin(origins = "*")
public class MailController extends Controller {
private final UserService userService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
@RequestMapping("/api/account/mail-students")
@Slf4j
@RequiredArgsConstructor
@CrossOrigin(origins = "*")
public class MailStudentsController extends Controller {
private final UserService userService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
@RequestMapping("/api/account/sign-in")
@Slf4j
@RequiredArgsConstructor
@CrossOrigin(origins = "*")
public class SignInController extends Controller {
private final UserService userService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
@RequestMapping("/api/account/sign-up")
@RequiredArgsConstructor
@Slf4j
@CrossOrigin(origins = "*")
public class SignUpController extends Controller {

private static final String EMAIL_REGEX = "^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
@RequestMapping("/api/account/update")
@RequiredArgsConstructor
@Slf4j
@CrossOrigin(origins = "*")
public class UpdateController extends Controller {

private static final String EMAIL_REGEX = "^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
@RequestMapping("/api/account/user")
@RequiredArgsConstructor
@Slf4j
@CrossOrigin(origins = "*")
public class UserController extends Controller {

private final UserService userService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ spring.datasource.password=root
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.show-sql=true
server.port=8086
server.port=8086

eureka.client.service-url.defaultZone=http://discovery-server:8761/eureka
spring.application.name=account-manager
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
33 changes: 33 additions & 0 deletions code/api-gateway/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
Binary file added code/api-gateway/.mvn/wrapper/maven-wrapper.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions code/api-gateway/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
9 changes: 9 additions & 0 deletions code/api-gateway/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM openjdk:21

ENV TZ=Europe/Rome

COPY target/*.jar api-gateway-app.jar

ENTRYPOINT ["java","-jar","/api-gateway-app.jar"]

EXPOSE 8080
Loading

0 comments on commit e88bcce

Please sign in to comment.