Last active
January 22, 2019 17:40
-
-
Save kesor/0c9b71a47aa54efa1cb7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| ) | |
| func handler(w http.ResponseWriter, r *http.Request) { | |
| fmt.Printf(w, "Hello World!") | |
| } | |
| func main() { | |
| http.HandleFunc("/", handler) | |
| http.ListenAndServe(":8080", nil) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from redis import Redis | |
| def application(env, start_response): | |
| redis = Redis(host='redis', port=6379) | |
| redis.incr('hits') # increment | |
| start_response('200 OK', [('Content-Type','text/html')]) | |
| return ['Hello World! I have been seen %s times.' % redis.get('hits')] | |
| if __name__ == "__main__": | |
| from wsgiref.simple_server import make_server | |
| httpd = make_server('', 8080, application) | |
| httpd.serve_forever() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def application(env, start_response): | |
| start_response('200 OK', [('Content-Type','text/html')]) | |
| return ["Hello World!"] | |
| if __name__ == "__main__": | |
| from wsgiref.simple_server import make_server | |
| httpd = make_server('', 8080, application) | |
| httpd.serve_forever() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| run Proc.new { |env| | |
| [ 200, | |
| {'Content-Type' => 'text/html'}, | |
| [ "Hello world!" ] | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment