#No boilerplate REST backed api
7 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @frank flax! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
bump
Javalin exists
and if you need something more powerful, you could use Spring Boot which can do it with only a bit of boilerplate:
@SpringBootApplication
public class YourApplicationClass{
public static void main(String[] args){
SpringApplication.run(YourApplicationClass.class, args);
}
}
record YourEntity(String someString, int someInt){}
@RestController
public class YourAPIController{
@GetMapping("/test")
public YourEntity handleSomeRequest(){
return new YourEntity("Hello World",1337);
}
}
This would requests to localhost:8080/test yielding the following response (or similar):
{
"someString": "Hello World",
"someInt": 1337;
}
Awesome, thanks!