Added GSON to gradle | /allCaches now returns a JSON with All Caches in DB
This commit is contained in:
parent
c6a9b77a0a
commit
af2c4e49ea
1
.idea/modules.xml
generated
1
.idea/modules.xml
generated
@ -5,6 +5,7 @@
|
|||||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/de.hhn.labsw.labswp_2019_sose_geocaching.iml" filepath="$PROJECT_DIR$/.idea/modules/de.hhn.labsw.labswp_2019_sose_geocaching.iml" />
|
<module fileurl="file://$PROJECT_DIR$/.idea/modules/de.hhn.labsw.labswp_2019_sose_geocaching.iml" filepath="$PROJECT_DIR$/.idea/modules/de.hhn.labsw.labswp_2019_sose_geocaching.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/de.hhn.labsw.labswp_2019_sose_geocaching.main.iml" filepath="$PROJECT_DIR$/.idea/modules/de.hhn.labsw.labswp_2019_sose_geocaching.main.iml" />
|
<module fileurl="file://$PROJECT_DIR$/.idea/modules/de.hhn.labsw.labswp_2019_sose_geocaching.main.iml" filepath="$PROJECT_DIR$/.idea/modules/de.hhn.labsw.labswp_2019_sose_geocaching.main.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/de.hhn.labsw.labswp_2019_sose_geocaching.test.iml" filepath="$PROJECT_DIR$/.idea/modules/de.hhn.labsw.labswp_2019_sose_geocaching.test.iml" />
|
<module fileurl="file://$PROJECT_DIR$/.idea/modules/de.hhn.labsw.labswp_2019_sose_geocaching.test.iml" filepath="$PROJECT_DIR$/.idea/modules/de.hhn.labsw.labswp_2019_sose_geocaching.test.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/labswp_2019_sose_geocaching.iml" filepath="$PROJECT_DIR$/.idea/labswp_2019_sose_geocaching.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@ -30,6 +30,9 @@ dependencies {
|
|||||||
|
|
||||||
//Thymeleaf
|
//Thymeleaf
|
||||||
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
|
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
|
||||||
|
|
||||||
|
//JSON Parser
|
||||||
|
implementation 'com.google.code.gson:gson:2.8.5'
|
||||||
}
|
}
|
||||||
|
|
||||||
node {
|
node {
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
package hhn.labsw.bugageocaching.controller;
|
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.CacheRepository;
|
||||||
import hhn.labsw.bugageocaching.repositories.RewardRepository;
|
import hhn.labsw.bugageocaching.repositories.RewardRepository;
|
||||||
import hhn.labsw.bugageocaching.repositories.StationRepository;
|
import hhn.labsw.bugageocaching.repositories.StationRepository;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -18,4 +22,10 @@ public class Controller {
|
|||||||
@Autowired
|
@Autowired
|
||||||
StationRepository stationRepository;
|
StationRepository stationRepository;
|
||||||
|
|
||||||
|
@RequestMapping("/allCaches")
|
||||||
|
@ResponseBody
|
||||||
|
public String getAllCaches(){
|
||||||
|
return new Gson().toJson(cacheRepository.findAll());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user