Skip to content

Commit

Permalink
Merge pull request #3 from fadiinho/refactor/default-host-and-port
Browse files Browse the repository at this point in the history
refactor: defaults host to `localhost` and port to `5000`
  • Loading branch information
luisviniciuslv committed Jan 26, 2023
2 parents 1a95b88 + f4605b6 commit 31cbebb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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()

0 comments on commit 31cbebb

Please sign in to comment.