Created
January 28, 2023 12:52
-
-
Save javascripto/4b52ac03c3594630b4836701b34a65d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from http.server import HTTPServer, BaseHTTPRequestHandler | |
| class RequestHandler(BaseHTTPRequestHandler): | |
| def do_GET(self): | |
| self.send_response(200) | |
| self.send_header('Content-Type', 'text/html') | |
| self.end_headers() | |
| file = open('index.html', 'r') | |
| index = file.read() | |
| file.close() | |
| self.wfile.write(index.encode()) | |
| if __name__ == '__main__': | |
| httpd = HTTPServer(('localhost', 8080), RequestHandler) | |
| print('Running on http://localhost:8080') | |
| httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment