HTTP Libraries / HTTP Server

0

My question is about web servers and libraries focused on the HTTP protocol.

In PHP you can use "apache" as a web server, but in other languages is the same stack used? This question came to me when I searched for languages like Go , Crystal , Hack , Ruby and Python .

I saw that they have libraries focused on the HTTP protocol, in them you create your own web server, serving itself or is a complement to apache (for example)?

Would it be how you create your own "requisitions" structure, shaping as you need them?

I've always kept this doubt, I know I'll always need a web server, but I do not know if apache or nginx will ever fit (the ones I know).

Example:

 Código tirado do site: cystal-lang.org

 require "http/server"

 server = HTTP::Server.new(8080) do |context|
  context.response.content_type = "text/plain"
  context.response.print "Hello world, got #{context.request.path}!"
 end

puts "Listening on http://0.0.0.0:8080"
server.listen

Thankful

    
asked by anonymous 25.08.2016 / 04:51

1 answer

0

It would not be like Apache because embedded servers are very limited, complete servers like Apache have numerous configurations and extra features that the built-in servers do not have. Usually they serve for quick testing or simplistic implementations. PHP itself has a built-in server, you can enable this feature by running the following command:

php -S localhost:8000

To understand the above command better read this page

    
25.08.2016 / 05:26