kopia lustrzana https://github.com/cirospaciari/socketify.py
added falcon
rodzic
9f66752b18
commit
24d9d950b2
|
@ -0,0 +1,24 @@
|
|||
from wsgiref.simple_server import make_server
|
||||
|
||||
import falcon
|
||||
|
||||
class Home:
|
||||
def on_get(self, req, resp):
|
||||
resp.status = falcon.HTTP_200 # This is the default status
|
||||
resp.content_type = falcon.MEDIA_TEXT # Default is JSON, so override
|
||||
resp.text = "Hello, World!"
|
||||
|
||||
|
||||
app = falcon.App()
|
||||
|
||||
home = Home()
|
||||
app.add_route('/', home)
|
||||
|
||||
if __name__ == '__main__':
|
||||
with make_server('', 8000, app) as httpd:
|
||||
print('Serving on port 8000...')
|
||||
|
||||
# Serve until process is killed
|
||||
httpd.serve_forever()
|
||||
|
||||
#pypy3 -m gunicorn falcon_plaintext:app -w 1
|
Ładowanie…
Reference in New Issue