Coder Social home page Coder Social logo

gpalleschi / quotes_api Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 4.26 MB

Quote API RESTful Node.js based Multilingual (Italian, English and Spanish) is a free, open source quote api to get random quote. Quotes are loaded on sqlite3 DB.

Home Page: https://quotes-api-three.vercel.app/api

License: GNU General Public License v3.0

JavaScript 95.60% HTML 4.40%
sqlite3 sqlite3-database nodejs rest-api restful-api quotes multilingual nodeexpress api vercel

quotes_api's Introduction

quote_api

Quote API RESTful Node.js based Multilingual (Italian, English and Spanish) is a free, open source quote api to get random quote. Quotes are loaded on sqlite3 DB.

API Reference


Random

GET /api/randomquote

Return a random quote.

Query parameters

Param Type Description Mandatory
language String Language Code (ex. en, it, es) Yes

Response

{
    // Quote
    quote: string
    // Author name
    author: string
    // tags
    tags: string
}

Examples

http://localhost:35907/api/randomquote?language=en

{
  "quote": "Three things cannot be long hidden: the sun, the moon, and the truth.",
  "author": "Buddha",
  "tags": "famous"
}

RandomImage

GET /api/randomimage

Return a random image with a quote.

Query parameters

Param Type Description Mandatory
language String Language Code (ex. en, it, es) Yes
newmode String If present and its value is different from no show random image from https://random.imagecdn.app No

Response

An image in html format.

Examples

http://localhost:35907/api/randomimage?language=en

ExampleRandomImage


Info

GET /api/Info

Return info about total quotes and authors.

Query parameters

Param Type Description Mandatory
language String Language Code (ex. en, it, es) Yes

Response

{
    // Language code
    language: string
    // Total quotes loaded
    quotes: number
    // Total authors loaded 
    authors: number
}

Examples

http://localhost:35907/api/info?language=en

{
  "language": "en",
  "quotes": 1746,
  "authors": 717
}

Authors

GET /api/authors

Return list of Authors with relative total quotes.

Query parameters

Param Type Description Mandatory
language String Language Code (ex. en, it, es) Yes
search String String to research Author in like sql format (ex. %Goethe%) No

Response

{
    // Author Name
    author: string
    // Total quotes loaded
    totQuotes: number
}

Examples

http://localhost:35907/api/authors?language=it&search=%OSCAR%

[
  {
    "author": "Oscar Wilde",
    "totQuotes": 91
  }
]

Quotes

GET /api/quotes

Return list of quotes of an author.

Query parameters

Param Type Description Mandatory
language String Language Code (ex. en, it, es) Yes
author String String to research Author in like sql format (ex. %Goethe%) Yes
limit Numeric Limit quotes extracted (Default value is 10) No

Response

{
    // Total quotes founded
    totQuotes: number
    quotes: array<{
        // Quote
        quote: string
        // Author name
        author: string
        // tags
        tags: string      
    }>
}

Examples

http://localhost:35907/api/quotes?language=en&author=%Obama%

{
  "totQuotes": 6,
  "quotes": [
    {
      "quote": "If you're walking down the right path and you're willing to keep walking, eventually you'll make progress.",
      "author": "Barack Obama",
      "tags": "famous"
    },
    {
      "quote": "Focusing your life solely on making a buck shows a poverty of ambition. It asks too little of yourself. And it will leave you unfulfilled.",
      "author": "Barack Obama",
      "tags": "famous"
    },
    {
      "quote": "Change will not come if we wait for some other person or some other time. We are the ones weve been waiting for. We are the change that we seek.",
      "author": "Barack Obama",
      "tags": "famous"
    },
    {
      "quote": "Change will not come if we wait for some other person or some other time. We are the ones weve been waiting for. We are the change that we seek.",
      "author": "Barack Obama",
      "tags": "famous"
    },
    {
      "quote": "Focusing your life solely on making a buck shows a poverty of ambition. It asks too little of yourself. And it will leave you unfulfilled.",
      "author": "Barack Obama",
      "tags": "famous"
    },
    {
      "quote": "If you're walking down the right path and you're willing to keep walking, eventually you'll make progress.",
      "author": "Barack Obama",
      "tags": "famous"
    }
  ]
}

Error Managment

Error Response

{
    // Language code
    error: number,
    // Function Name
    function: string,
    // Description error
    description: string
}

Prerequisites

  • Node v16.13.1 or upper
  • npm v7.19.1 or upper

Built With

NPM Modules

npm install

Run

npm start

Authors

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE 3.0 License - see the LICENSE file for details

quotes_api's People

Contributors

gpalleschi avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

tacman

quotes_api's Issues

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.