By this package you can get a list of countries, states and districts. This package also allow to get districts and states in hindi and marathi also.
Note: This plugin will return a list of countries, states and districts by using our few methods. This will work with Node.js
npm i @coffeebeanslabs/country_state_district
It returns the details of the countries.
let country_state_district = require('@coffeebeanslabs/country_state_district');
let countries = country_state_district.getAllCountries();
Return value:
[
{ "id": 1, "name": "India" }
]
It returns the details of the states.
let country_state_district = require('@coffeebeanslabs/country_state_district');
let states = country_state_district.getAllStates();
Return value:
[
{ "id": 32, "name": "Tamil Nadu", "en_name": "Tamil Nadu", "hi_name": "तमिलनाडु", "mr_name": "तामिळनाडू", "country_id": 1 }
]
It accepts a valid Country ID
and returns State Details
let country_state_district = require('@coffeebeanslabs/country_state_district');
let states = country_state_district.getStatesByCountryId(1);
Return value:
[
{ "id": 32, "name": "Tamil Nadu", "en_name": "Tamil Nadu", "hi_name": "तमिलनाडु", "mr_name": "तामिळनाडू", "country_id": 1 }
]
It returns the details of the states.
let country_state_district = require('@coffeebeanslabs/country_state_district');
let districts = country_state_district.getAllDistricts();
Return value:
[
{ "id": 32, "name": "Tamil Nadu", "en_name": "Tamil Nadu", "hi_name": "तमिलनाडु", "mr_name": "तामिळनाडू", "country_id": 1 }
]
It accepts a valid State ID
and returns District Details
let country_state_district = require('@coffeebeanslabs/country_state_district');
let districts = country_state_district.getDistrictsByStateId(32);
Return value:
[
{ "id": 578, "name": "Thoothukudi", "en_name": "Thoothukudi", "mr_name": "थुथुकुडी", "hi_name": "थुथुकुडी", "state_id": 32 }
]