Git Product home page Git Product logo

thewordsapi-backend's Introduction

theWordsAPI - BackEnd

TheWordsAPI is a free English-English dictionary API developed for educational purposes.

theWordsAPI - Frontend Link

https://github.com/imshawan/theWords-Frontend

Important Note: Only dummy database (100 entries each) is provided with this source code, please prepare your own database for deployment purposes.

Testing

npm test

Local Run

npm install && npm start

API Usage :: Methods supported -> ['GET']

API URLS

https://the-words.herokuapp.com/api/v2/definitions/en-US/entries/

https://the-words.herokuapp.com/api/v2/audio/en-US/entries/

To fetch definations

Using Curl:

curl https://the-words.herokuapp.com/api/v2/definitions/en-US/entries/hello
   -H "Accept: application/json" 

Using Python

URL = f"https://the-words.herokuapp.com/api/v2/definitions/en-US/entries/hello"
HEADERS={'Accept': 'application/json'}
response = requests.get(URL, headers=HEADERS)
print(response.text)

Response:

{
    "id": 27833,
    "word": "hello",
    "meanings": [
        {
            "partOfSpeech": "noun",
            "definitions": [
                {
                    "definition": "An utterance of “hello”; a greeting.",
                    "synonyms": [
                        "greeting",
                        "welcome",
                        "salutation",
                        "saluting",
                        "hailing",
                        "address",
                        "hello",
                        "hallo"
                    ],
                    "example": "she was getting polite nods and hellos from people"
                }
            ]
        },
        {
            "partOfSpeech": "intransitive verb",
            "definitions": [
                {
                    "definition": "Say or shout “hello”; greet someone.",
                    "example": "I pressed the phone button and helloed"
                }
            ]
        },
        {
            "partOfSpeech": "exclamation",
            "definitions": [
                {
                    "definition": "Used as a greeting or to begin a phone conversation.",
                    "example": "hello there, Katie!"
                }
            ]
        }
    ]
}

To fetch pronunciation data

Using Curl:

curl https://the-words.herokuapp.com/api/v2/audio/en-US/entries/hello
   -H "Accept: application/json" 

Using Python

URL = f"https://the-words.herokuapp.com/api/v2/audio/en-US/entries/hello"
HEADERS={'Accept': 'application/json'}
response = requests.get(URL, headers=HEADERS)
print(response.text)

Response:

{
    "id": 22998,
    "word": "hello",
    "contents": [
        {
            "pronunciation": "he-loh, huh-, hel-oh",
            "audio": "https://static.sfdict.com/audio/lunawav/H01/H0178500.ogg"
        }
    ]
}

Deployment

After signing up on Heroku, create a new app, and proceed to download Heroku CLI

heroku login -i
heroku builds:create -a <name_of_your_app>

About

Copyright (c) 2021 Shawan Mandal.

thewordsapi-backend's People

Contributors

imshawan avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.