Live data from Hacker News

Shinatra – A simple bash web server

github.com

21–30 of 37 posts

Re: Shinatra – A simple bash web server

#21
post #17

Bash (shell-script) is a very powerful language, but a bit too complicated for the non-programmer (computer hacker). Then we got Perl, but it is also a bit too complicated. Now we have JavaScript doing the same thing, but also JavaScript (ES6) is now getting more complicated. I wonder is there a rule that says a (scripting) language for non-programmers will eventually either die or end up being too complicated for no…

Never heard "Build a system that even a fool can use and only a fool will want to use it." ?

Re: Shinatra – A simple bash web server

#23
post #16

Earlier quoted context omitted.

Considering C has the semicolon, you can probably write it in less than 5 because you can put almost anything on a single line.

Bash also has a semicolon. This script could be done in two lines. Or even one if you omit the shebang.

What if you remove the audio jack?

Re: Shinatra – A simple bash web server

#26
This reminds me a lot of Certbot's use of the Python SimpleHTTPServer:

  $(command -v python2 || command -v python2.7 || command -v python2.6) -c
  "import BaseHTTPServer, SimpleHTTPServer;
  s = BaseHTTPServer.HTTPServer(('', {port}), SimpleHTTPServer.SimpleHTTPRequestHandler);
  s.serve_forever()"

Re: Shinatra – A simple bash web server

#27
post #21
post #17

Bash (shell-script) is a very powerful language, but a bit too complicated for the non-programmer (computer hacker). Then we got Perl, but it is also a bit too complicated. Now we have JavaScript doing the same thing, but also JavaScript (ES6) is now getting more complicated. I wonder is there a rule that says a (scripting) language for non-programmers will eventually either die or end up being too complicated for no…

Never heard "Build a system that even a fool can use and only a fool will want to use it." ?

A small amount of pessimism is healthy, but something being really simple is often preferable. A key here is good abstraction. Take for example a file system, witch is very easy to use, but still useful for computer experts.

Re: Shinatra – A simple bash web server

#28

This reminds me a lot of Certbot's use of the Python SimpleHTTPServer: $(command -v python2 || command -v python2.7 || command -v python2.6) -c "import BaseHTTPServer, SimpleHTTPServer; s = BaseHTTPServer.HTTPServer(('', {port}), SimpleHTTPServer.SimpleHTTPRequestHandler); s.serve_forever()"

Out of curiosity. What is wrong with: python -m SimpleHTTPServer ?

Re: Shinatra – A simple bash web server

#29
post #12

> Is this a thread based server, or does it use an event loop instead? > No. Well, which is it ?

Neither, its using netcat + -l flag, which is (possibly) waiting for a connection using blocking networking IO. It can only accept one connection at a time because of the netcat command being used in a loop

Oh OK.

Well, anyone can write that in a handful of lines in most languages.

Re: Shinatra – A simple bash web server

#30

Many people here fail to realize, this is an excellent debugging server. I used to have a server to print out the body and headers of requests when building an api to make sure things were going (the right headers and request body) out as expected https://github.com/minhajuddin/httpdebug/blob/master/app.go . This is a much lighter and nicer version. This is going into my ~/bin/httpdebug :) You can try sending a few c…

Maybe I'm misunderstanding by why not just have your server have a a request logging middleware that respects some log level environment variable?
Post reply on HN