this is my server code import http.server
import socketserver
import urllib.parse
import requests


PORT = 8000  # The port used by the server
DICTIONARY_API_KEY = '2bb83c92-3f74-482a-bafc-6b90561625af'  # The Merriam-Webster Dictionary API key
THESAURUS_API_KEY = '9915a792-e3ce-4a13-9830-69706fd5adc1'  # Merri-Webster Thesaurus API key

def get_meaning(word):
    # Get the meaning from the Merriam-Webster Dictionary API
    dictionary_url = f'https://www.dictionaryapi.com/api/v3/references/collegiate/json/{word}?key={DICTIONARY_API_KEY}'
    dictionary_response = requests.get(dictionary_url)
    if dictionary_response.status_code == 200:
        dictionary_data = dictionary_response.json()
        if len(dictionary_data) > 0 and 'shortdef' in dictionary_data[0]:
            meaning = dictionary_data[0]['shortdef'][0]
        else:
            meaning = 'No meaning found'
    else:
        meaning = 'No meaning found'
    
    # Get the synonyms from the Merriam-Webster Thesaurus API
    thesaurus_url = f'https://www.dictionaryapi.com/api/v3/references/thesaurus/json/{word}?key={THESAURUS_API_KEY}'
    thesaurus_response = requests.get(thesaurus_url)
    if thesaurus_response.status_code == 200:
        thesaurus_data = thesaurus_response.json()
        synonyms = thesaurus_data[0].get('meta', {}).get('syns', [])
        if synonyms:
            synonyms_str = ', '.join(synonyms[0])
            meaning += f' (Synonyms: {synonyms_str})'
    return meaning


class MyRequestHandler(http.server.SimpleHTTPRequestHandler):
    def do_GET(self):
        parsed_url = urllib.parse.urlparse(self.path)
        query_params = urllib.parse.parse_qs(parsed_url.query)
        if 'word' in query_params:
            word = query_params['word'][0]
            meaning = get_meaning(word)
            response = 'No meaning found' if meaning == 'No meaning found' else f'{meaning}'
            self.send_response(200)
            self.send_header('Content-type', 'text/plain')
            self.send_header('Access-Control-Allow-Origin', '*')  # Allow requests from any origin
            self.end_headers()
            self.wfile.write(response.encode())
        else:
            super().do_GET()

with socketserver.TCPServer(("", PORT), MyRequestHandler) as httpd:
    print(f"Server listening on port {PORT}")
    httpd.serve_forever()
