Skip to content

Instantly share code, notes, and snippets.

@sescotti
Last active April 3, 2019 18:34
Show Gist options
  • Save sescotti/f89a70be1a111721e579abc9a6a24042 to your computer and use it in GitHub Desktop.
Save sescotti/f89a70be1a111721e579abc9a6a24042 to your computer and use it in GitHub Desktop.
HelloController.kt
package careers.debut.api
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.http.ResponseEntity.ok
@RestController
@RequestMapping("/hello")
class HelloController {
@GetMapping("/{name}")
fun greet(@PathVariable("name") name: String) = ok(GreetDto("Hello $name!"))
data class GreetDto(val message: String)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment