File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -7,4 +7,5 @@ pydantic==1.6.1
7
7
uvicorn == 0.11.3
8
8
pyramid == 1.10.4
9
9
waitress == 1.4.4
10
- bottle == 0.12.18
10
+ bottle == 0.12.18
11
+ tornado == 6.0.4
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+
3
+ import json
4
+ from tornado .web import Application , RequestHandler
5
+ from tornado .ioloop import IOLoop
6
+ from src .servers .config import host , port
7
+
8
+ class HelloHandler (RequestHandler ):
9
+ def post (self ):
10
+ data = json .loads (self .request .body )
11
+ self .set_header ('Content-Type' , 'application/json' )
12
+ self .write (json .dumps ({ 'hello' : data ['name' ] }))
13
+
14
+ def make_app ():
15
+ urls = [('/hello' , HelloHandler )]
16
+ return Application (urls , debug = True )
17
+
18
+ def run_test ():
19
+ print ('Server starting at ' + 'http://{}:{}' .format (host , port ))
20
+
21
+ app = make_app ()
22
+ app .listen (port , host )
23
+ IOLoop .current ().start ()
24
+
25
+ if __name__ == '__main__' :
26
+ run_test ()
You can’t perform that action at this time.
0 commit comments