To get the URL of a controller method, first change the following method to explicitly declare it as an Action.
import com.greenfossil.thorium.{*, given}
@Get("/sayHello/:name")
def sayHello(@Param name: String) = Action: request =>
s"Hello $name"
To obtain the URL, call the function with the endpoint, followed by the url method.
import com.greenfossil.thorium.{*, given}
val url: String = SimpleController.sayHello("John Doe").endpoint.url
Last modified on 22/11/2023, 3:39 pm