Jump to content

Programming Challenge: Build a Simple Quote API (Dec 24, 2024)

Featured Replies

Posted

Challenge:
Create a RESTful API that serves inspirational quotes. The API should allow users to:

  1. Fetch a random quote
  2. Fetch a quote by ID
  3. Add a new quote

Requirements:

  • Use any programming language or framework (e.g., Python with Flask, Node.js with Express, etc.).
  • Store the quotes in a file (JSON, text, or CSV) or a database.
  • Return responses in JSON format.

Bonus Points:

  • Implement authentication for adding a new quote.
  • Include a search endpoint to find quotes by keyword.
  • Deploy your API using a lightweight server manager like PM2 or Docker.

Example Endpoints:

  1. GET /quote/random - Returns a random quote.
  2. GET /quote/{id} - Returns a specific quote by ID.
  3. POST /quote - Adds a new quote (authenticated).
  4. GET /quote/search?keyword={keyword} - Searches for quotes by keyword.

Sample Output:

{
  "id": 1,
  "quote": "The best way to predict the future is to invent it.",
  "author": "Alan Kay"
}

Rules:

  • Post your solution as a reply in the thread, linking to your repository (e.g., GitHub or GitLab).
  • Explain your implementation briefly.

You can see an example in my signature.

  • Jessica Brown changed the title to Programming Challenge: Build a Simple Quote API (Dec 24, 2024)
  • Views 188
  • Created
  • Last Reply

Create an account or sign in to comment

Important Information

Terms of Use Privacy Policy Guidelines We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.