Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# SpringBootApp
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.
1 change: 0 additions & 1 deletion SpringBootApp
Submodule SpringBootApp deleted from fe35c8
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id 'java'
}


group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
Expand All @@ -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 {
Expand Down
37 changes: 37 additions & 0 deletions src/main/java/com/example/accessingdatajpa/Food.java
Original file line number Diff line number Diff line change
@@ -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;}

}
Original file line number Diff line number Diff line change
@@ -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<Food, Long> {

}
19 changes: 16 additions & 3 deletions src/main/java/com/example/springboot/HelloController.java
Original file line number Diff line number Diff line change
@@ -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);
}

}
}
30 changes: 30 additions & 0 deletions src/main/java/com/example/springboot/ThymeleafController.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
10 changes: 10 additions & 0 deletions src/main/java/com/example/springboot/config/Endpoints.java
Original file line number Diff line number Diff line change
@@ -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";

}
33 changes: 33 additions & 0 deletions src/main/java/com/example/springboot/config/HomeController.java
Original file line number Diff line number Diff line change
@@ -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";
}

}

8 changes: 8 additions & 0 deletions src/main/java/com/example/springboot/config/ViewNames.java
Original file line number Diff line number Diff line change
@@ -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";
}
16 changes: 16 additions & 0 deletions src/main/java/com/example/springboot/config/WebMvcConfig.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.springboot.config;

import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;

public interface WebMvcConfigImpl {
void ViewControllers(ViewControllerRegistry registry);
}
22 changes: 22 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -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
71 changes: 71 additions & 0 deletions src/main/resources/css/css.css
Original file line number Diff line number Diff line change
@@ -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%;
}
}
Empty file.
16 changes: 16 additions & 0 deletions src/main/resources/static/js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const app = Vue.createApp({});

app.component('app', {
data() {
return {
count : 0
}
},
template: `<button = "count++")>
You clicked me {{count}} times.
</button>`

})

app.mount('#components-demo')

12 changes: 12 additions & 0 deletions src/main/resources/templates/Food.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Food</title>
</head>
<body>
<nav>

</nav>
</body>
</html>
34 changes: 34 additions & 0 deletions src/main/resources/templates/Registration.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Registration</title>
</head>
<body>
<form action="action_page.php">
<div class="container">
<h1>Register</h1>
<p>Please fill this form to create an account.</p>
<hr>

<label for="email"><b>Email</b></label>
<input type="text" placeholder="Enter Email" name="email" id="email" required>

<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" id="psw" required>

<label for="psw-repeat"><b>Repeat Password</b></label>
<input type="password" placeholder="Repeat Password" name="psw-repeat" id="psw-repeat" required>
<hr>

<p>By creating an account you agree to our <a href="#">Terms & Privacy</a>.</p>
<button type="submit" class="registerbtn">Register</button>
</div>

<div class="container signin">
<p>Already have an account? <a href="login.html">Log in</a>
&nbsp.</p>
</div>
</form>
</body>
</html>
Loading