diff --git a/.gitignore b/.gitignore
index 9a4a0e0..6c08a57 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,8 @@ labswp_2019_sose_geocaching.iml
# public folder
src/main/resources/public/
+.idea/
+
# Gradle
.idea/**/gradle.xml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 8b96030..4aac343 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -6,6 +6,8 @@
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 8310c4f..0f33646 100644
--- a/build.gradle
+++ b/build.gradle
@@ -27,6 +27,12 @@ dependencies {
//MariaDB
implementation 'org.mariadb.jdbc:mariadb-java-client'
+
+ //Thymeleaf
+ compile("org.springframework.boot:spring-boot-starter-thymeleaf")
+
+ //JSON Parser
+ implementation 'com.google.code.gson:gson:2.8.5'
}
node {
diff --git a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java
new file mode 100644
index 0000000..9a8501d
--- /dev/null
+++ b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java
@@ -0,0 +1,31 @@
+package hhn.labsw.bugageocaching.controller;
+
+import com.google.gson.Gson;
+import hhn.labsw.bugageocaching.entities.Cache;
+import hhn.labsw.bugageocaching.repositories.CacheRepository;
+import hhn.labsw.bugageocaching.repositories.RewardRepository;
+import hhn.labsw.bugageocaching.repositories.StationRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class Controller {
+
+ @Autowired
+ CacheRepository cacheRepository;
+
+ @Autowired
+ RewardRepository rewardRepository;
+
+ @Autowired
+ StationRepository stationRepository;
+
+ @RequestMapping("/allCaches")
+ @ResponseBody
+ public String getAllCaches(){
+ return new Gson().toJson(cacheRepository.findAll());
+ }
+
+}
diff --git a/src/main/java/hhn/labsw/bugageocaching/db/DBConnector.java b/src/main/java/hhn/labsw/bugageocaching/db/DBConnector.java
new file mode 100644
index 0000000..fbfceea
--- /dev/null
+++ b/src/main/java/hhn/labsw/bugageocaching/db/DBConnector.java
@@ -0,0 +1,58 @@
+package hhn.labsw.bugageocaching.db;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+public class DBConnector {
+
+ /*
+ * Installation of the web service
+ *
+ * The following parameters have to be changed for setting up the web service in another environment.
+ * DB_HOST = Address of the database. Examples: localhost, 192.168.12.7, mydomain.com
+ * DB_USER = Username for the database connection
+ * DB_PASSWORD = Password for the database connection
+ * DATABASE = Name of the database that shall be used
+ *
+ */
+ private static final String DB_HOST = "www.se.hs-heilbronn.de:3406/buga19Geocaching";
+ private static final String DB_USER = "BuGa19GeocachingUser";
+ private static final String DB_PASSWORD = "GeocachingPw";
+
+ /*
+ * For setting up the Webservice no changes are needed from here!
+ */
+
+ private static final Logger logger = LoggerFactory.getLogger(DBConnector.class);
+
+ public static Connection connect() {
+
+ logger.debug("Trying to establish connection to database");
+
+ try {
+ Class.forName("org.mariadb.jdbc.Driver");
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+
+ /*
+ * Connect to database
+ */
+ Connection connection = null;
+
+ try {
+ connection = DriverManager.getConnection("jdbc:mariadb://" + DB_HOST + "?user=" + DB_USER + "&password=" + DB_PASSWORD);
+ logger.debug("Connected");
+ } catch (SQLException e) {
+ System.out.println(e.getMessage());
+ e.printStackTrace();
+ }
+
+ return connection;
+ }
+
+}