Created
July 3, 2018 09:00
-
-
Save waghanza/81f8c3ebe29b9b705b070d17197e069b to your computer and use it in GitHub Desktop.
This file contains 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.httpserver | |
import tornado.ioloop | |
import tornado.web | |
class MainHandler(tornado.web.RequestHandler): | |
def get(self): | |
self.write('') | |
class UserHandler(tornado.web.RequestHandler): | |
def post(self): | |
self.write('') | |
class UserInfoHandler(tornado.web.RequestHandler): | |
def get(self, id): | |
self.write(id) | |
if __name__ == '__main__': | |
app = tornado.web.Application(handlers=[(r'/', MainHandler), | |
(r"/user", UserHandler), | |
(r"/user/(\d+)", UserInfoHandler)]) | |
http_server = tornado.httpserver.HTTPServer(app) | |
http_server.bind(3000, address='0.0.0.0') | |
http_server.start(0) | |
tornado.ioloop.IOLoop.current().start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment