diff --git a/README.md b/README.md index 5e87a63..40e76cb 100644 --- a/README.md +++ b/README.md @@ -1 +1,5 @@ -# SpringBootApp \ No newline at end of file +Food Map zur vietnamesischen Küche in Deutschland + +Diese Website ist ein Ort, wo köstliche vietnamesische Gerichten in Deutschland geteilt werden. Sie wird mit einer Karte (wahrscheinlich Google) verknüpft. Beste Standorte zu Gerichten nach Städten bzw Bezirken sortiert werden. Auch detaillierte wahre Erfahrungen von Besuchern zu jedem Standort sind zu finden. + +Außerdem gibt es die Möglichkeit, die Ursprung jedes Gerichts herauszufinden. An dieser Stelle werden auch beste Standorte für jeweiliges Gericht in Vietnam gezeigt. Es sollte leichter gehen, den vollen Geschmack dieses Gerichts zu genießen, wenn man nach Vietnam kommt. \ No newline at end of file diff --git a/SpringBootApp b/SpringBootApp deleted file mode 160000 index fe35c8b..0000000 --- a/SpringBootApp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fe35c8b362647699d22f50b10438e37a407c168b diff --git a/build.gradle b/build.gradle index 4cd4393..a91d6b8 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,7 @@ plugins { id 'java' } + group = 'com.example' version = '0.0.1-SNAPSHOT' sourceCompatibility = '11' @@ -15,8 +16,13 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-web' + //implementation 'org.springframework.boot:spring-boot-starter-data-jdbc' + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + implementation 'org.springframework.boot:spring-boot-starter-jdbc' developmentOnly 'org.springframework.boot:spring-boot-devtools' testImplementation 'org.springframework.boot:spring-boot-starter-test' + runtimeOnly 'org.postgresql:postgresql' + runtimeOnly 'com.h2database:h2' } test { diff --git a/src/main/java/com/example/accessingdatajpa/Food.java b/src/main/java/com/example/accessingdatajpa/Food.java new file mode 100644 index 0000000..586c91b --- /dev/null +++ b/src/main/java/com/example/accessingdatajpa/Food.java @@ -0,0 +1,37 @@ +package com.example.accessingdatajpa; + +import org.springframework.beans.factory.annotation.Autowired; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class Food { + + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private String name ; + private Long id; + private String origin; + private String location; + + + public Food () { + this.name = name; + this.id = id; + this.origin = origin; + this.location = location; + } + + public Long getId() {return id;} + + public String getName() {return name;} + + public String getOrigin() {return origin;} + + public String getLocation() { return location;} + +} \ No newline at end of file diff --git a/src/main/java/com/example/accessingdatajpa/FoodRepository.java b/src/main/java/com/example/accessingdatajpa/FoodRepository.java new file mode 100644 index 0000000..0aa547d --- /dev/null +++ b/src/main/java/com/example/accessingdatajpa/FoodRepository.java @@ -0,0 +1,9 @@ +package com.example.accessingdatajpa; + +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + + @Repository + public interface FoodRepository extends CrudRepository { + +} diff --git a/src/main/java/com/example/springboot/HelloController.java b/src/main/java/com/example/springboot/HelloController.java index 7cfc2a7..4b8b5c8 100644 --- a/src/main/java/com/example/springboot/HelloController.java +++ b/src/main/java/com/example/springboot/HelloController.java @@ -1,14 +1,27 @@ package com.example.springboot; -import org.springframework.web.bind.annotation.RestController; +import com.example.springboot.config.Endpoints; +import com.example.springboot.config.ViewNames; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.ModelAndView; @RestController public class HelloController { + @RequestMapping("/") public String index() { - return "Hello World!"; + return "Welcome to Food Map!"; + } + + @GetMapping("/hello") + public String welcome(@RequestParam(value = "name", defaultValue = "world") String name) { + return String.format("Hello, %s", name); } -} \ No newline at end of file +} diff --git a/src/main/java/com/example/springboot/ThymeleafController.java b/src/main/java/com/example/springboot/ThymeleafController.java new file mode 100644 index 0000000..6ed9af0 --- /dev/null +++ b/src/main/java/com/example/springboot/ThymeleafController.java @@ -0,0 +1,30 @@ +package com.example.springboot; + +import com.example.springboot.config.Endpoints; +import com.example.springboot.config.ViewNames; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.servlet.ModelAndView; + +@Controller +public class ThymeleafController { + @GetMapping(path = Endpoints.INDEX) + public ModelAndView IndexPage() { + return new ModelAndView(ViewNames.INDEX); + } + + @GetMapping(path = Endpoints.FOOD) + public ModelAndView FoodShowing() { + return new ModelAndView(ViewNames.FOOD); + } + + @GetMapping(path = Endpoints.LOGIN) + public ModelAndView Login() { + return new ModelAndView(ViewNames.LOGIN); + } + + @GetMapping(path = Endpoints.REGISTRATION) + public ModelAndView Registration() { + return new ModelAndView(ViewNames.REGISTRATION); + } +} diff --git a/src/main/java/com/example/springboot/config/Endpoints.java b/src/main/java/com/example/springboot/config/Endpoints.java new file mode 100644 index 0000000..9020519 --- /dev/null +++ b/src/main/java/com/example/springboot/config/Endpoints.java @@ -0,0 +1,10 @@ +package com.example.springboot.config; + +public class Endpoints { + + public static final String INDEX = "/i"; + public static final String FOOD = "/food"; + public static final String LOGIN = "/login"; + public static final String REGISTRATION ="/registration"; + +} diff --git a/src/main/java/com/example/springboot/config/HomeController.java b/src/main/java/com/example/springboot/config/HomeController.java new file mode 100644 index 0000000..614468c --- /dev/null +++ b/src/main/java/com/example/springboot/config/HomeController.java @@ -0,0 +1,33 @@ +package com.example.springboot.config; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class HomeController { + + @RequestMapping("/") + public String welcome() { + return "index"; + } + + @RequestMapping("/home") + public String home() { + return "index"; + } + + + @RequestMapping("/login") + public String login() { + return "login"; + } + + @RequestMapping("/registration") + public String registration() { + return "Registration"; + } + + } + diff --git a/src/main/java/com/example/springboot/config/ViewNames.java b/src/main/java/com/example/springboot/config/ViewNames.java new file mode 100644 index 0000000..c6c6b6e --- /dev/null +++ b/src/main/java/com/example/springboot/config/ViewNames.java @@ -0,0 +1,8 @@ +package com.example.springboot.config; + +public class ViewNames { + public static final String INDEX = "index"; + public static final String FOOD = "food"; + public static final String LOGIN = "login"; + public static final String REGISTRATION = "registration"; +} diff --git a/src/main/java/com/example/springboot/config/WebMvcConfig.java b/src/main/java/com/example/springboot/config/WebMvcConfig.java new file mode 100644 index 0000000..a04fa7b --- /dev/null +++ b/src/main/java/com/example/springboot/config/WebMvcConfig.java @@ -0,0 +1,16 @@ +package com.example.springboot.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class WebMvcConfig implements WebMvcConfigurer, WebMvcConfigImpl { + + @Override + public void ViewControllers(ViewControllerRegistry registry) { + registry.addViewController(Endpoints.INDEX).setViewName(ViewNames.INDEX); + registry.addViewController(Endpoints.FOOD).setViewName(ViewNames.FOOD); + registry.addViewController(Endpoints.LOGIN).setViewName(ViewNames.LOGIN); + } +} diff --git a/src/main/java/com/example/springboot/config/WebMvcConfigImpl.java b/src/main/java/com/example/springboot/config/WebMvcConfigImpl.java new file mode 100644 index 0000000..e2ff40d --- /dev/null +++ b/src/main/java/com/example/springboot/config/WebMvcConfigImpl.java @@ -0,0 +1,7 @@ +package com.example.springboot.config; + +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; + +public interface WebMvcConfigImpl { + void ViewControllers(ViewControllerRegistry registry); +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8b13789..2936049 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +1,23 @@ +spring: + datasource: + username: ${DATASOURCE_USERNAME} + password: ${DATASOURCE_PASSWORD} + url: ${DATASOURCE_URL} + driver-class-name: org.postgresql.Driver + platform: postgres + initialization-mode: always + +jpa: + properties: + hibernate: + #The SQL dialect makes Hibernate generate better SQL for the chosen database + dialect: org.hibernate.dialect.PostgreSQLDialect + jdbc: + time_zone: UTC + +show-sql: false #Set true for debugging +database-platform: org.hibernate.dialect.PostgreSQLDialect + + ddl-auto: update # (creat, creat-drop, validate, update) +open-in-view: false \ No newline at end of file diff --git a/src/main/resources/css/css.css b/src/main/resources/css/css.css new file mode 100644 index 0000000..d6a8120 --- /dev/null +++ b/src/main/resources/css/css.css @@ -0,0 +1,71 @@ +/* Bordered form */ +form { + border: 3px solid #f1f1f1; +} + +/* Full-width inputs */ +input[type=text], input[type=password] { + width: 100%; + padding: 12px 20px; + margin: 8px 0; + display: inline-block; + border: 1px solid #ccc; + box-sizing: border-box; +} + +/* Set a style for all buttons */ +button { + background-color: #04AA6D; + color: white; + padding: 14px 20px; + margin: 8px 0; + border: none; + cursor: pointer; + width: 100%; +} + +/* Add a hover effect for buttons */ +button:hover { + opacity: 0.8; +} + +/* Extra style for the cancel button (red) */ +.cancelbtn { + width: auto; + padding: 10px 18px; + background-color: #f44336; +} + +/* Center the avatar image inside this container */ +.imgcontainer { + text-align: center; + margin: 24px 0 12px 0; +} + +/* Avatar image */ +img.avatar { + width: 40%; + border-radius: 50%; +} + +/* Add padding to containers */ +.container { + padding: 16px; +} + +/* The "Forgot password" text */ +span.psw { + float: right; + padding-top: 16px; +} + +/* Change styles for span and cancel button on extra small screens */ +@media screen and (max-width: 300px) { + span.psw { + display: block; + float: none; + } + .cancelbtn { + width: 100%; + } +} \ No newline at end of file diff --git a/src/main/resources/static/js/dymanic.js b/src/main/resources/static/js/dymanic.js new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/static/js/main.js b/src/main/resources/static/js/main.js new file mode 100644 index 0000000..6c1c709 --- /dev/null +++ b/src/main/resources/static/js/main.js @@ -0,0 +1,16 @@ +const app = Vue.createApp({}); + +app.component('app', { + data() { + return { + count : 0 + } + }, + template: `` + +}) + +app.mount('#components-demo') + diff --git a/src/main/resources/templates/Food.html b/src/main/resources/templates/Food.html new file mode 100644 index 0000000..df70205 --- /dev/null +++ b/src/main/resources/templates/Food.html @@ -0,0 +1,12 @@ + + + + + Food + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/Registration.html b/src/main/resources/templates/Registration.html new file mode 100644 index 0000000..8b0e723 --- /dev/null +++ b/src/main/resources/templates/Registration.html @@ -0,0 +1,34 @@ + + + + + Registration + + +
+
+

Register

+

Please fill this form to create an account.

+
+ + + + + + + + + +
+ +

By creating an account you agree to our Terms & Privacy.

+ +
+ + +
+ + \ No newline at end of file diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html new file mode 100644 index 0000000..9abcbd9 --- /dev/null +++ b/src/main/resources/templates/index.html @@ -0,0 +1,48 @@ + + + + + Title + + + + +
+

{{msg}}

+
+ + + + + + + + + + diff --git a/src/main/resources/templates/layout.html b/src/main/resources/templates/layout.html new file mode 100644 index 0000000..1d80453 --- /dev/null +++ b/src/main/resources/templates/layout.html @@ -0,0 +1,12 @@ + + + + + Title + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html new file mode 100644 index 0000000..46cb1b7 --- /dev/null +++ b/src/main/resources/templates/login.html @@ -0,0 +1,35 @@ + + + + + Login + + +
+
+ +
+ +
+ + + + + + + + +
+ +
+ + Forgot password? +
+
+ + + \ No newline at end of file diff --git a/system.properties b/system.properties new file mode 100644 index 0000000..558a90a --- /dev/null +++ b/system.properties @@ -0,0 +1 @@ +java.runtime.version = 16