Skip to content

Instantly share code, notes, and snippets.

@diegolirio
Last active November 16, 2021 13:45
Show Gist options
  • Select an option

  • Save diegolirio/82447bcab90acbaeb966287a78476b70 to your computer and use it in GitHub Desktop.

Select an option

Save diegolirio/82447bcab90acbaeb966287a78476b70 to your computer and use it in GitHub Desktop.
@Transactional
@Path("/customers")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
class CustomerEntrypoint {
@POST
fun created(customer: CustomerEntity): CustomerEntity {
customer.persist()
return customer
}
@GET
@Path("/{id}")
fun get(@PathParam("id") id: Long): CustomerEntity? {
return CustomerEntity.findById(id)
}
@GET
fun getList(): List<CustomerEntity> {
return CustomerEntity.findAll().list()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment