created json-server.py and nss_handler.py modules.
nss_handler.py defines a simple HTTP server using Python's http.server module. It includes an Enum class for HTTP status codes and a custom request handler class HandleRequests that extends BaseHTTPRequestHandler. The HandleRequests class provides methods to handle HTTP responses, parse URLs to extract resources and query parameters, and set response headers. It also implements an OPTIONS method to handle CORS preflight requests. The response method is used to send HTTP responses with a given status code and body, while the parse_url method breaks down the URL into its components for easier processing.
in the json-server.py module, The do_GET method prepares to handle GET requests, while do_PUT and do_POST read and parse the JSON request body for updating or creating resources, respectively. The do_DELETE method prepares to handle deletion of resources. The main function sets up the server to listen on port 8000 and serve requests indefinitely. the remaining logic to call methods from specific views is left for others to add when appropriate.
created json-server.py and nss_handler.py modules.
nss_handler.py defines a simple HTTP server using Python's http.server module. It includes an Enum class for HTTP status codes and a custom request handler class HandleRequests that extends BaseHTTPRequestHandler. The HandleRequests class provides methods to handle HTTP responses, parse URLs to extract resources and query parameters, and set response headers. It also implements an OPTIONS method to handle CORS preflight requests. The response method is used to send HTTP responses with a given status code and body, while the parse_url method breaks down the URL into its components for easier processing.
in the json-server.py module, The do_GET method prepares to handle GET requests, while do_PUT and do_POST read and parse the JSON request body for updating or creating resources, respectively. The do_DELETE method prepares to handle deletion of resources. The main function sets up the server to listen on port 8000 and serve requests indefinitely. the remaining logic to call methods from specific views is left for others to add when appropriate.