app-const.py 599 B

12345678910111213141516171819202122232425262728
  1. import multiprocessing
  2. import os
  3. from robyn import Robyn
  4. from robyn.argument_parser import Config
  5. class SpecialConfig(Config):
  6. def __init__(self):
  7. super().__init__()
  8. self.workers = 2
  9. self.processes = (os.cpu_count() * 2) + 1
  10. self.log_level = "WARN"
  11. app = Robyn(__file__, config=SpecialConfig())
  12. @app.get("/plaintext", const=True)
  13. def plaintext() -> str:
  14. return "Hello, world!"
  15. if __name__ == "__main__":
  16. app.add_response_header("Server", "Robyn")
  17. app.add_response_header("Content-Type", "text/plain")
  18. app.start(url="0.0.0.0", port=8080)