Created
April 29, 2018 22:08
-
-
Save selcukusta/165cc2adbbf7e133907a6061c5d27f0a 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
| import tornado.ioloop | |
| import tornado.web | |
| import socket | |
| class MainHandler(tornado.web.RequestHandler): | |
| def get(self): | |
| self.write("Hello world!") | |
| def data_received(self, data): | |
| pass | |
| class StatusHandler(tornado.web.RequestHandler): | |
| def get(self): | |
| self.write(socket.gethostname()) | |
| def data_received(self, data): | |
| pass | |
| def application_start(): | |
| return tornado.web.Application([ | |
| (r"/", MainHandler), | |
| (r"/status", StatusHandler) | |
| ]) | |
| if __name__ == "__main__": | |
| APP = application_start() | |
| APP.listen(8888) | |
| tornado.ioloop.IOLoop.current().start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment