File: http_server.cr

package info (click to toggle)
crystal 1.18.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,712 kB
  • sloc: javascript: 6,400; sh: 769; makefile: 300; ansic: 121; python: 105; cpp: 77; xml: 32
file content (11 lines) | stat: -rw-r--r-- 264 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
# A very basic HTTP server
require "http/server"

server = HTTP::Server.new do |context|
  context.response.content_type = "text/plain"
  context.response.print "Hello world!"
end

address = server.bind_tcp 8080
puts "Listening on http://#{address}"
server.listen