4 ms·
I added a simple example to the README that shows for to build a single-endpoint API and also how to do things in JSON with the type system instead of annotatio
by moring 3y ago
I added a simple example to the README that shows for to build a single-endpoint API and also how to do things in JSON with the type system instead of annotations.
- nunobrito 3y agoMoring, this is looking really simple to adopt, good work. First question: is there maven already available for this library? Mostly to ease upgrades in the future. Second question: what strategy would you recommend for adding https on the communication channel? Thanks.
- moring 3y agoHi, thanks for your feedback. Maven integration is not there yet. Gradle makes it easy to generate a POM, but I have honestly never published anything to central, and I don't even know what is necessary for that. I have added this to my to-do list. HTTPS is something I won't have to deal with myself, because I'll be running it in a context (Cloud Run on Google Cloud Platform) with external HTTPS termination. If you have any chance to do the same, I'd highly recommend it, because you can use standardized solutions. Other than that, the current version runs on embedded Jetty, but is actually just a servlet code-wise, so any servlet container would do. Again, this is not possible out-of-the-box (unless you don't mind cloning grumpyrest and modifying the code), but likely will be in the future. Once you can use a standard servlet container, such as Tomcat, you can just follow the normal how-tos on how to add HTTPS.
- winrid 3y agoMuch better! By the way, how does it compare to Spark? https://sparkjava.com/ https://sparkjava.com/
- moring 3y agoSee https://news.ycombinator.com/item?id=36284955 https://news.ycombinator.com/item?id=36284955
- caeril 3y agoStill not clear how one is supposed to wire this to the servlet container. You instantiate a RestApi object and then . . . . magic?
- moring 3y agoThe demo code (now in subproject grumpyrest-demo) has a complete example. It works like this: public static class MyServlet extends RestServlet { public MyServlet() { super(buildApi()); } private static RestApi buildApi() { RestApi api = new RestApi(); ... return api; } } It's a bit annoying right now, but that's because the servlet is supposed to be constructed by the servlet container using a no-arg constructor. I hope I can improve this in the future.