Skip to content

timelessco/country-flags

Repository files navigation

Welcome to Country Flags Serverless Functions!

Deployed GET URLs

  1. By Country Name

Link :

https://country-flags-topaz.vercel.app/api/getCountryFlagByCountryName?countryName=Portugal

Usage :

<img src="https://country-flags-topaz.vercel.app/api/getCountryFlagByCountryName?countryName=Portugal" height="150">

Response :

  1. By ISO2Code

Link :

https://country-flags-topaz.vercel.app/api/getCountryFlagByISO2Code?iso2code=AU

Usage :

<img src="https://country-flags-topaz.vercel.app/api/getCountryFlagByISO2Code?iso2code=AU" height="150">

Response :

  1. By ISO3Code

Link :

https://country-flags-topaz.vercel.app/api/getCountryFlagByISO3Code?iso3code=DEU

Usage :

<img src="https://country-flags-topaz.vercel.app/api/getCountryFlagByISO3Code?iso3code=DEU" height="150">

Response :

  1. By Nationality

Link :

https://country-flags-topaz.vercel.app/api/getCountryFlagByNationality?nationality=Indian

Usage :

<img src="https://country-flags-topaz.vercel.app/api/getCountryFlagByNationality?nationality=Indian" height="150">

Response :

Deployed POST URLs

Usage

  1. By Nationality- https://country-flags-topaz.vercel.app/api/getCountryByNationality image

  2. By Name- https://country-flags-topaz.vercel.app/api/getFlagUrlByCountryName image

  3. By ISO2 Code- https://country-flags-topaz.vercel.app/api/getFlagUrlByISO2Code image

  4. By ISO3 Code- https://country-flags-topaz.vercel.app/api/getFlagUrlByISO3Code image

  5. All Countries- https://country-flags-topaz.vercel.app/api/getAllCountries image

APIs Available When Trying Locally

  1. api/getAllCountries

Usage

      const res = await axios({
        method: "GET",
        headers: {
          "Content-Type": "application/json",
        },
        url: `api/getAllCountries`,
      });
  1. api/getCountryByNationality

Usage

      const res = await axios({
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        url: `api/getCountryByNationality`,
        data: JSON.stringify({ nationality: "Australian" }),
      });
  1. api/getFlagUrlByCountryName

Usage

      const res = await axios({
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        url: `api/getFlagUrlByCountryName`,
        data: JSON.stringify({ countryName: "Australia" }),
      });
  1. api/getFlagUrlByISO2Code

Usage

      const res = await axios({
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        url: `api/getFlagUrlByISO2Code`,
        data: JSON.stringify({ iso2Code: "AU" }),
      });
  1. api/getFlagUrlByISO3Code

Usage

      const res = await axios({
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        url: `api/getFlagUrlByISO3Code`,
        data: JSON.stringify({ iso3Code: "AU" }),
      });

Deploy It Yourself 🎉

Deploy to Vercel

Check out Next.js deployment documentation for more details.