Skip to content

Instantly share code, notes, and snippets.

@kesor
Last active January 22, 2019 17:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kesor/0c9b71a47aa54efa1cb7 to your computer and use it in GitHub Desktop.
Save kesor/0c9b71a47aa54efa1cb7 to your computer and use it in GitHub Desktop.
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)
}
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()
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()
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