Skip to content

countries. It includes data such as country names, continents, ISO1/2 currency codes, and much more. This API serves as a complete resource for accessing detailed country-specific information.

Notifications You must be signed in to change notification settings

onlymachiavelli/worldAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WORLD WIDE API

This API provides you with the basic informations about countries (name, continent, iso2,iso3 , currencycode , and flags soon !)


Get all the datas !

https://worldapi.onrender.com/

Use AXIOS for better experience !

https://axios-http.com/docs/intro

npm i --save axios

const axios = require('axios')

 import axios from 'axios'

Get world wide datas

const myAPI = async () => {
  const response = await axios.get("https://worldapi.onrender.com/")
  .then((res: any) => {
    return res.data
  })
  return response.WORLD
}

Calling It

myAPI().then(
  (res:any) =>{
    console.log(res)
   }
)

Get country Data by index Like countryName, iso1/iso2 JSON OBJECT

const myAPI = async (index, data) => {
  const response = await axios.get(`https://worldapi.onrender.com/by?field=${index}&target=${data}`)
  
  
  
  
  .then((res: any) => {
    return res.data
  })
  return response.data
}

Calling It (by country Name)

 myAPI("name", "Morocco").then(
  (res:any) =>{
    console.log(res)
  }
)

Calling It (by iso1)

myAPI("iso1", "MA").then(
  (res:any) =>{
    console.log(res)
  }
)

Calling It (by iso2)

myAPI("iso2", "MAR").then(
  (res:any) =>{
    console.log(res)
  }
)

Get counties by the currency or the continent (Array of countries)

const myAPI = async (index, data) => {
  const response = await axios.get(`https://worldapi.onrender.com/by?field=${index}&target=${data}`)
  .then((res: any) => {
    return res.data
  })
  return response.datas
}

Calling It by currency

myAPI("currency", "EUR").then(
  (res:any) =>{
    console.log(res)
  }
)

Calling It by continent

myAPI("continent", "Europe").then(
  (res:any) =>{
    console.log(res)
  }
)

About

countries. It includes data such as country names, continents, ISO1/2 currency codes, and much more. This API serves as a complete resource for accessing detailed country-specific information.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published