Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: defaults host to localhost and port to 5000 #3

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/PyForgeAPI/classes/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __init__(self, cors, static_path, application, host, port, debug, routes):
self.cors = cors
self.static_path = static_path
self.application = application
self.host = host if host else socket.gethostbyname(socket.gethostname())
self.host = host if host != "0.0.0.0" else socket.gethostbyname(socket.gethostname())
self.port = port
self.debug = debug
self.routes = routes
Expand All @@ -34,4 +34,4 @@ def run(self) -> None:
httpd.serve_forever()
except KeyboardInterrupt:
print('PyForgeAPI Server Stopped')
httpd.server_close()
httpd.server_close()
4 changes: 2 additions & 2 deletions src/PyForgeAPI/decorators/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def internal(func) -> None:
return func
return internal

def run(self, application="API", host=None, port=80):
def run(self, application="API", host="localhost", port=5000):
Server(
self._cors,
self.static_path,
Expand All @@ -102,4 +102,4 @@ def run(self, application="API", host=None, port=80):
port,
self.debug,
self.routes
).run()
).run()