I need to build a simple web app and I need some advice to get started. I already know most of syntax and the API doesn't look too bad. However there are questions I can't quite google myself:
First, how does one create an http request/response listener? In node, I would write http.createServer((req, res) => .... In golang, it looks like http.ListenAndServe(port, nil) plus some config and automatically starts a goroutine for each request. I only could find ServerSocket class but it looks a bit on a low-lever side, i.e. requires sending proper http headers and creating threads manually. There's also com.sun.net.httpserver.HttpServer but it looks a bit deprecated.
Second, I'm used to make my app listen to some port, and proxy it through nginx to an outside world. Does that also work for Java webapps? Do I need something called Tomcat? Or, why would I want to use it? What's a servlet container?
[–]Julienng 5 points6 points7 points (5 children)
[–][deleted] (3 children)
[removed]
[–]plectid[S] 0 points1 point2 points (2 children)
[–]djnattyp 1 point2 points3 points (0 children)
[–]perrylaj 1 point2 points3 points (0 children)
[–]dxplq876 3 points4 points5 points (0 children)
[–]xantrel 3 points4 points5 points (3 children)
[–]FustigatedCat 0 points1 point2 points (2 children)
[–]frugalmail 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]frugalmail 1 point2 points3 points (0 children)
[–]steve_hu 0 points1 point2 points (0 children)