Skip to content

kakotyanimesh/apiG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

API Generator Application

This is a full-stack application that allows users to generate, fetch, and clear book APIs dynamically. The backend is built with Node.js and Express.js, while the frontend uses React and Axios to interact with the API.

Features

  • Generate API: Creates a list of books with randomly generated titles and author names.
  • Fetch Data: Fetches the list of books generated by the API.
  • Clear API: Clears the existing list of books from the API.
  • Dark Mode: Toggle between light and dark mode.

Tech Stack

  • Frontend: React, Axios, Tailwind CSS
  • Backend: Node.js, Express.js
  • Database: JSON File (for simplicity)
  • Hosting: Frontend (Vercel), Backend (Render)

Installation

  1. Clone the repository:

    git clone https://github.com/kakotyanimesh/apiG.git

Here's the README in Markdown (.md) format:

  1. Navigate to the project directory:

    cd apiG
  2. Install dependencies for both frontend and backend:

    # Backend dependencies
    npm install
    
    # Frontend dependencies (navigate to the frontend folder)
    cd frontend
    npm install
  3. Run the backend server:

    npm start

    The backend will run at http://localhost:3000.

  4. Run the frontend:

    cd frontend
    npm run dev

    The frontend will run at http://localhost:5173.

API Endpoints

Get All Books

GET /books
  • Response: List of all generated books.

Generate New API

POST /generateApi
  • Response: Creates 30 new books with random titles and authors.

Clear API Data

DELETE /delete
  • Response: Clears all existing books.

Frontend Interaction

  • Generate API: Click on the "Generate API" button to create a new list of books.
  • Fetch Data: Click on the "Get Data" button to fetch the list of books.
  • Clear API: Click on the "Clear API" button to remove all books from the API.
  • Dark Mode: Toggle the sun/moon icon to switch between light and dark themes.

Demo

License

This project is open-source and available under the MIT License.