<s> from growler import App <EOL> from growler . router import routerclass <EOL> @ routerclass <EOL> class QuickRoute : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , param ) : <EOL> """<STR_LIT>""" <EOL> self . param = param <EOL> self . name_dict = dict ( ) <EOL> def get_root ( self , req , res ) : <EOL> """<STR_LIT>""" <EOL> res . send_json ( { '<STR_LIT>' : self . param } ) <EOL> def post_name ( self , req , res ) : <EOL> """<STR_LIT>""" <EOL> name = req . get_body ( ) <EOL> if name in self . name_dict : <EOL> txt = "<STR_LIT>" % ( name , self . name_dict [ name ] ) <EOL> else : <EOL> self . name_dict [ name ] = <NUM_LIT:0> <EOL> txt = "<STR_LIT>" % ( name ) <EOL> res . render_text ( txt ) <EOL> def get_name ( self , req , res ) : <EOL> """<STR_LIT>""" <EOL> name = req . params [ '<STR_LIT:name>' ] <EOL> try : <EOL> self . name_dict [ name ] += <NUM_LIT:1> <EOL> txt = "<STR_LIT>" % ( name , self . name_dict [ name ] ) <EOL> except KeyError : <EOL> txt = "<STR_LIT>" % ( name ) <EOL> res . render_text ( txt ) <EOL> app = App ( "<STR_LIT>" ) <EOL> app . use ( QuickRoute ( '<STR_LIT>' ) , '<STR_LIT:/>' ) <EOL> app . create_server_and_run_forever ( port = <NUM_LIT> , host = '<STR_LIT:127.0.0.1>' ) </s>
