removed HTML template from REST controller
This commit is contained in:
parent
5c033cbbdc
commit
f29ebcd74c
@ -15,17 +15,14 @@ class JokeController {
|
||||
|
||||
@Autowired
|
||||
lateinit var jokeService: JokeService
|
||||
|
||||
@RequestMapping(value=["/", ""], method = [RequestMethod.GET])
|
||||
fun showJoke(model : Model) : String {
|
||||
model.addAttribute("joke", jokeService.joke)
|
||||
return "chucknorris"
|
||||
}
|
||||
|
||||
@GetMapping(value=["/joke", ""], produces = [MediaType.APPLICATION_JSON_VALUE])
|
||||
fun showJokeJSON(model : Model) : String {
|
||||
model.addAttribute("joke", jokeService.jokeJSON)
|
||||
return "chucknorris"
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.becausesec.chuckjokes.controllers
|
||||
|
||||
import com.becausesec.chuckjokes.services.JokeService
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.http.MediaType
|
||||
import org.springframework.ui.Model
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.ResponseBody
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
class JokesRestController {
|
||||
|
||||
@Autowired
|
||||
lateinit var jokeService: JokeService
|
||||
|
||||
@GetMapping(value=["/joke", ""], produces = [MediaType.APPLICATION_JSON_VALUE])
|
||||
@ResponseBody
|
||||
fun showJokeJSON(model : Model) : String {
|
||||
return jokeService.jokeJSON
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user