/quote-generator-api

quote generator API built with nodejs and harperdb

Primary LanguageJavaScriptMIT LicenseMIT

quote-generator-api

Quote generator API built with nodejs and harperdb.

You can find the article for this API here

Live version Quote API.

How to use.

Clone the repo

git clone https://github.com/Lucky-victory/quote-generator-api

Move into the directory

cd quotes-generator-api

Copy the .env.example file to the .env file

cp .env.example .env

Fill out the following placeholders with correct details.

Now, Run the following command.

 npm install
 npm run db:init
 npm run start

The server would start at http://localhost:3300

Routes

  • /quotes: method:GET:get all quotes, you can also limit the number quotes to return by passing query param limit, e.g /quotes?limit=5
  • /quotes/random: method:GET: get a random quote.
  • /quotes/create method:POST: make a post request to this route to add a new quote.
  • /quotes/:quote_id method:PUT: update a quote.
  • /quotes/:quote_id method:DELETE: delete a quote.
  • /quotes/category/:category method:GET: get quotes by category, e.g /quotes/category/motivational , you can also limit the number quotes to return by passing query param limit, e.g /quotes/category/motivational?limit=5.
  • /quotes/author/:author method:GET: get quotes by author, e.g /quotes/author/steve jobs , you can also limit the number quotes to return by passing query param limit, e.g /quotes/author/steve jobs?limit=5