News for hackers. Stuff that matters.
Re:Ask HN: What web framework should I use nowadays? by data37 on Saturday August 20, 2016 @09:04AM (#12326388)
Here is what I settled with for my website after trying a few things over the years. In the process I have discarded nodejs, JAX-RS, maven, Undertow, JQuery, bootstrap (partially) etc.

Currently, pure java servlets serve json over REST-like API. The jar dependencies are servlet-api.jar, a couple of json-related jars and an sqlite jar. Multiple fine-grained sqlite files for data. Tomcat as the servlet container with no static content.

A nodejs reverse proxy forks the API and static web requests between tomcat and another nodejs static webserver. The static content is angualrjs + html + css with minimal and reusable js files mostly fetching json data. I also have a little bootstrap dependency for forms.

I have an apache ant build file that copies the ~60kb war file and static content directly to the production from my dev system. Tried maven before but Ant seemed much simpler and more than enough for my needs. The ant build does a lot other things also.

I use Eclipse for the easy navigability across the code and other nice refactoring features. Ant does all the build work.

Earlier I tried pure nodejs (no java), then JAX-RS and then Undertow container etc. Nothing seemed simpler than the current setup. By the way, the site is https://worktheme.com

Re:Ask HN: What web framework should I use nowadays? by jonesetc on Saturday August 20, 2016 @09:40AM (#12326528)
> A nodejs reverse proxy forks the API and static web requests between tomcat and another nodejs static webserver.

Just curious why you don't use nginx here. It will serve static files and proxy to the API. I'm sure the nodejs proxy was easy enough, but adding in gzipping files, rewrite rules, SSL, etc and it seems like nginx would even end up being more simple.

Re:Ask HN: What web framework should I use nowadays? by data37 on Saturday August 20, 2016 @11:04AM (#12326897)
NodeJS rev proxy allows custom logic after intercepting requests - all in javascript. Not sure if NGinx would allow that. But yes, I would probably move to Nginx in near future for its tomcat-like robustness.
Re:Ask HN: What web framework should I use nowadays? by sevengraff on Saturday August 20, 2016 @01:01PM (#12327358)
Your system of minimal dependency java is interesting. Do you have anything open source I can look at or otherwise get a dive into this technique?
Re:Ask HN: What web framework should I use nowadays? by data37 on Saturday August 20, 2016 @11:22PM (#12329242)
Sure - Will publish to github and post here. For a brief note, the java servlets use Google's gson for interfacing wih web requests. Beyond that it is all plain old JDBC with sqlite. That is all to the "API" part of our service :-)
Re:Ask HN: What web framework should I use nowadays? by ehsan_akbari on Saturday August 20, 2016 @09:44PM (#12329085)
Come on, Java is a very rare language of choice for web development since I can't think of a popular website written in Java :|
Re:Ask HN: What web framework should I use nowadays? by data37 on Saturday August 20, 2016 @11:03PM (#12329212)
It depends on what you mean by a "website". You need to understand that a web application need to have a client-side (managing user interaction) and a server-side (mostly fetching data). Java is still more popular than any other technology for the server-side part. May be you should read more. And think more.
Re:Ask HN: What web framework should I use nowadays? by ehsan_akbari on Sunday August 21, 2016 @08:48AM (#12330739)
I meant the back-end. Noone bothers to write the front-end with these languages ( ASP.Net is an exception ) when there are tons of great JS libraries avalable.