Skip to content

Latest commit

 

History

History
145 lines (117 loc) · 2.91 KB

File metadata and controls

145 lines (117 loc) · 2.91 KB

Node Faker API

Node Faker API is a simple Node.js project that provides endpoints to generate random data for various categories such as Persons, Locations, Ecommerce, Finance, Date, and Localization. This project uses the Faker.js library to generate realistic fake data for testing and development purposes.

Getting Started

Prerequisites

  • Node.js and npm installed on your machine. You can download and install them from Node.js.

Installation

  1. Clone the repository:

    git clone https://github.com/msaifulcsse/node-faker-api.git
    cd node-faker-api
  2. Install the dependencies:

    npm install

Running the Server

Start the server by running the following command:

node index.js

The server will be running on http://localhost:5000.

API Endpoints

Get Random Profiles

  • Endpoint: /api/random-profiles
  • Method: GET
  • Description: Returns a list of 10 random profiles.
  • Response:
    [
      {
        "name": "John Doe",
        "email": "john.doe@example.com",
        "address": "123 Main St",
        "city": "Anytown",
        "country": "USA"
      },
      ...
    ]

Get Random Locations

  • Endpoint: /random-locations
  • Method: GET
  • Description: Returns a list of 10 random locations.
  • Response:
    [
      {
        "address": "123 Main St",
        "city": "Anytown",
        "country": "USA"
      },
      ...
    ]

Get Random Ecommerce Data

  • Endpoint: /random-ecommerce
  • Method: GET
  • Description: Returns a list of 10 random ecommerce data.
  • Response:
    [
      {
        "productName": "Awesome Widget",
        "price": "$19.99"
      },
      ...
    ]

Get Random Finance Data

  • Endpoint: /random-finance
  • Method: GET
  • Description: Returns a list of 10 random finance data.
  • Response:
    [
      {
        "accountNumber": "123456789",
        "transactionAmount": "$100.00"
      },
      ...
    ]

Get Random Dates

  • Endpoint: /random-dates
  • Method: GET
  • Description: Returns a list of 10 random dates.
  • Response:
    [
      {
        "date": "2025-01-18T22:39:00.000Z"
      },
      ...
    ]

Get Random Localization Data

  • Endpoint: /random-localization
  • Method: GET
  • Description: Returns a list of 10 random localization data.
  • Response:
    [
      {
        "locale": "en_US",
        "phoneNumber": "(555) 555-5555"
      },
      ...
    ]

Author

License

This project is licensed under the MIT License. See the LICENSE file for details.


Feel free to customize the `README.md` file as needed. This should give you a good starting point for your project documentation.