Skip to content

Commit

Permalink
fix http server snippet with crystal 0.27
Browse files Browse the repository at this point in the history
  • Loading branch information
icyleaf committed Dec 7, 2018
1 parent 8e2ed71 commit 482271b
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions snippets/crystal.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@
"HTTP simple server": {
"prefix": "http server",
"body": [
"server = HTTP::Server.new(${1:\"0.0.0.0\"}, ${2:8080}) do |context|",
"\tcontext.response.content_type = \"text/plain\"",
"\tcontext.response.print \"Hello world!\"",
"end"
"server = HTTP::Server.new do |context|",
"\tcontext.response.content_type = \"text/plain\"",
"\tcontext.response.print \"Hello world!\"",
"end",
"\nserver.bind_tcp ${1:\"0.0.0.0\"}, ${2:8080}",
"server.listen"
],
"description": "HTTP Server example."
},
"HTTP server with handlers": {
"prefix": "http server with handlers",
"body": [
"HTTP::Server.new(${1:\"127.0.0.1\"}, ${2:8080}, [",
"\tHTTP::ErrorHandler.new,",
"\tHTTP::LogHandler.new,",
"\tHTTP::StaticFileHandler.new(\".\"),",
"]).listen"
"server = HTTP::Server.new([",
"\tHTTP::ErrorHandler.new,",
"\tHTTP::LogHandler.new,",
"\tHTTP::StaticFileHandler.new(\".\"),",
"])",
"\nserver.bind_tcp ${1:\"0.0.0.0\"}, ${2:8080}",
"server.listen"
],
"description": "HTTP Server example with error, logs and static handler."
},
Expand Down

0 comments on commit 482271b

Please sign in to comment.