Skip to content

About

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Bharat States Cities API

Bharat States Cities API is a RESTful API that provides comprehensive information about states and cities in India. It offers an easy-to-use interface to access a curated list of Indian states and their respective cities, making it a valuable resource for applications requiring location-based data within the Indian subcontinent.

Table of Contents

Features

  • Retrieve a list of all Indian states.
  • Get detailed information about a specific state by its ID.
  • Fetch cities associated with a particular state.
  • Obtain a list of all cities across India.
  • Support for pagination and query parameters for flexible data retrieval.
  • Rate limiting to prevent abuse and ensure fair usage.

Getting Started

Prerequisites

  • Node.js (version 18.x recommended)
  • PostgreSQL database

Installation

  1. Clone the repository:

    git clone https://github.com/AshokWebWorks/Bharat-States-Cities-API.git
    cd bharat-states-cities-api
  2. Install dependencies:

    npm install
  3. Set up your PostgreSQL database and configure the connection details in db.js.

  4. Start the server:

    npm start

Usage

Endpoints

  • /v1/api/states: Get a list of all Indian states.
  • /v1/api/states/:id: Get details of a specific state by ID.
  • /v1/api/states/:id/cities: Get cities associated with a specific state.
  • /v1/api/cities: Get a list of all cities across India.
  • Examples

  • Get all states
  • GET http://localhost:3000/v1/api/states
  • Get details of a specific state (e.g., state with ID 1):
  • GET http://localhost:3000/v1/api/states/1
  • Get cities associated with a specific state (e.g., state with ID 1):
  • GET http://localhost:3000/v1/api/states/1/cities
  • Get a list of all cities across India:
  • GET http://localhost:3000/v1/api/cities

    Documentation

    For detailed information on available endpoints, query parameters, and response formats, refer to the API Documentation.

    Contributing

    Contributions are welcome! If you have any improvements, bug fixes, or feature requests, please submit an issue or a pull request.

    License

    This project is licensed under the MIT License.

    About

    Resources

    Stars

    0 stars

    Watchers

    1 watching

    Forks

    Releases

    Packages

    Used by

    Contributors

    Languages