Adding landing page

This commit is contained in:
Alejandro
2020-10-01 21:16:45 -05:00
parent 21e262b5e9
commit 596e12b2c4
8 changed files with 551 additions and 9 deletions
+6 -2
View File
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>dev.amatos.restcountries</groupId> <groupId>dev.amatos.restcountries</groupId>
<artifactId>dev.amatos.restcountries</artifactId> <artifactId>dev.amatos.restcountries</artifactId>
<version>0.1</version> <version>1</version>
<parent> <parent>
<groupId>io.micronaut</groupId> <groupId>io.micronaut</groupId>
@@ -99,7 +99,11 @@
<groupId>org.glassfish.jersey.core</groupId> <groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId> <artifactId>jersey-common</artifactId>
<version>2.22.2</version> <version>2.22.2</version>
<scope>test</scope> </dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.6.0.Final</version>
</dependency> </dependency>
</dependencies> </dependencies>
@@ -58,7 +58,7 @@ public class CountryController {
} }
} }
@Get("alpha-codes/") @Get("alpha/")
public Object getByAlphaList(@QueryParam("codes") String codes, @QueryParam("fields") Optional<String> fields) { public Object getByAlphaList(@QueryParam("codes") String codes, @QueryParam("fields") Optional<String> fields) {
if (isEmpty(codes) || codes.length() < 2 || (codes.length() > 3 && !codes.contains(","))) { if (isEmpty(codes) || codes.length() < 2 || (codes.length() > 3 && !codes.contains(","))) {
return getResponse(Response.Status.BAD_REQUEST); return getResponse(Response.Status.BAD_REQUEST);
+5
View File
@@ -89,6 +89,7 @@
"it": "Afghanistan", "it": "Afghanistan",
"ja": "\u30a2\u30d5\u30ac\u30cb\u30b9\u30bf\u30f3", "ja": "\u30a2\u30d5\u30ac\u30cb\u30b9\u30bf\u30f3",
"nl": "Afghanistan", "nl": "Afghanistan",
"pl":"Afganistan",
"pt": "Afeganist\u00e3o", "pt": "Afeganist\u00e3o",
"hu": "Afganiszt\u00e1n" "hu": "Afganiszt\u00e1n"
}, },
@@ -172,6 +173,7 @@
"it": "Albania", "it": "Albania",
"ja": "\u30a2\u30eb\u30d0\u30cb\u30a2", "ja": "\u30a2\u30eb\u30d0\u30cb\u30a2",
"nl": "Albani\u00eb", "nl": "Albani\u00eb",
"pl":"Albania",
"pt": "Alb\u00e2nia", "pt": "Alb\u00e2nia",
"hu": "Alb\u00e1nia" "hu": "Alb\u00e1nia"
}, },
@@ -273,6 +275,7 @@
"it": "Algeria", "it": "Algeria",
"ja": "\u30a2\u30eb\u30b8\u30a7\u30ea\u30a2", "ja": "\u30a2\u30eb\u30b8\u30a7\u30ea\u30a2",
"nl": "Algerije", "nl": "Algerije",
"pl":"Algieria",
"pt": "Arg\u00e9lia", "pt": "Arg\u00e9lia",
"hu": "Alg\u00e9ria" "hu": "Alg\u00e9ria"
}, },
@@ -351,6 +354,7 @@
"it": "Samoa Americane", "it": "Samoa Americane",
"ja": "\u30a2\u30e1\u30ea\u30ab\u9818\u30b5\u30e2\u30a2", "ja": "\u30a2\u30e1\u30ea\u30ab\u9818\u30b5\u30e2\u30a2",
"nl": "Amerikaans Samoa", "nl": "Amerikaans Samoa",
"pl":"Samoa Ameryka\u0144skie",
"pt": "Samoa Americana", "pt": "Samoa Americana",
"hu": "Amerikai Szamoa" "hu": "Amerikai Szamoa"
}, },
@@ -425,6 +429,7 @@
"it": "Andorra", "it": "Andorra",
"ja": "\u30a2\u30f3\u30c9\u30e9", "ja": "\u30a2\u30f3\u30c9\u30e9",
"nl": "Andorra", "nl": "Andorra",
"pl":"Andora",
"pt": "Andorra", "pt": "Andorra",
"hu": "Andorra" "hu": "Andorra"
}, },
+362
View File
@@ -0,0 +1,362 @@
REST Countries 🇵🇪
=======
Get information about countries via a RESTful API
*Current version: 1*
Donate!
---------------
If you want to donate to **this** project to help me pay the server bill, you are welcome to donate
[$5], [$10], [$15] o [more]. I would very much appreciate the help 😃
The original restcountries project was acquired by apilayer, one of the leading providers of
API microservices. As the original project has shown very little activity, I created this project
in order to provide a more updated version and with some fixes requested in the original project.
Users
---------------
This project is used by
- [Nations24](https://nations24.com)
Original RESTCountries project has over 1200 users, including:
- [TTÜ]
- [Spotify International Pricing Index]
- [Gorillaz]
- [Wanderlust]
- [Xero]
- [FxPro]
- [SKROSS]
- [onefinestay]
- [Much Better Adventures]
API Endpoints
=======
Below are described the REST endpoints available that you can use to search for countries
All
---------------
``` html
https://restcountries.com/v2/all
```
Name
---------------
Search by country name. It can be the native name or partial name
``` javascript
https://restcountries.com/v2/name/{name}
```
``` html
https://restcountries.com/v2/name/peru
```
``` html
https://restcountries.com/v2/name/united
```
Full Name
---------------
Search by country full name
``` javascript
https://restcountries.com/v2/name/{name}?fullText=true
```
``` html
https://restcountries.com/v2/name/aruba?fullText=true
```
Code
---------------
Search by ISO 3166-1 2-letter or 3-letter country code
``` javascript
https://restcountries.com/v2/alpha/{code}
```
``` html
https://restcountries.com/v2/alpha/pe
```
``` html
https://restcountries.com/v2/alpha/per
```
List of codes
---------------
Search by list of ISO 3166-1 2-letter or 3-letter country codes. The original project used *;* as
separator. In out case, the *comma* is used to separate values.
``` javascript
https://restcountries.com/v2/alpha?codes={code},{code},{code}
```
``` html
https://restcountries.com/v2/alpha?codes=col,pe,at
```
Currency
---------------
Search by ISO 4217 currency code
``` javascript
https://restcountries.com/v2/currency/{currency}
```
``` html
https://restcountries.com/v2/currency/pen
```
Language
---------------
Search by ISO 639-1 language code.
``` javascript
https://restcountries.com/v2/lang/{lang}
```
``` html
https://restcountries.com/v2/lang/es
```
Capital city
---------------
Search by capital city
``` javascript
https://restcountries.com/v2/capital/{capital}
```
``` html
https://restcountries.com/v2/capital/lima
```
Calling code
---------------
Search by calling code
``` javascript
https://restcountries.com/v2/callingcode/{callingcode}
```
``` html
https://restcountries.com/v2/callingcode/51
```
Continent
---------------
Search by continent: Africa, Americas, Asia, Europe, Oceania
``` javascript
https://restcountries.com/v2/continent/{region}
```
``` html
https://restcountries.com/v2/continent/europe
```
Regional Bloc
---------------
Search by regional bloc:
- EU (European Union)
- EFTA (European Free Trade Association)
- CARICOM (Caribbean Community)
- PA (Pacific Alliance)
- AU (African Union)
- USAN (Union of South American Nations)
- EEU (Eurasian Economic Union)
- AL (Arab League)
- ASEAN (Association of Southeast Asian Nations)
- CAIS (Central American Integration System)
- CEFTA (Central European Free Trade Agreement)
- NAFTA (North American Free Trade Agreement)
- SAARC (South Asian Association for Regional Cooperation)
``` javascript
https://restcountries.com/v2/regionalbloc/{regionalbloc}
```
``` html
https://restcountries.com/v2/regionalbloc/eu
```
Response Example
---------------
``` html
https://restcountries.com/v2/alpha/col
```
``` json
{
"name": "Colombia",
"topLevelDomain": [
".co"
],
"alpha2Code": "CO",
"alpha3Code": "COL",
"callingCodes": [
"57"
],
"capital": "Bogotá",
"altSpellings": [
"CO",
"Republic of Colombia",
"República de Colombia"
],
"region": "South America",
"continent": "Americas",
"population": 48759958,
"latlng": [
4.0,
-72.0
],
"demonym": "Colombian",
"area": 1141748.0,
"gini": 55.9,
"timezones": [
"UTC-05:00"
],
"borders": [
"BRA",
"ECU",
"PAN",
"PER",
"VEN"
],
"nativeName": "Colombia",
"numericCode": "170",
"currencies": [
{
"code": "COP",
"name": "Colombian peso",
"symbol": "$"
}
],
"languages": [
{
"iso639_1": "es",
"iso639_2": "spa",
"name": "Spanish",
"nativeName": "Español"
}
],
"translations": {
"br": "Colômbia",
"pt": "Colômbia",
"nl": "Colombia",
"hr": "Kolumbija",
"fa": "کلمبیا",
"de": "Kolumbien",
"es": "Colombia",
"fr": "Colombie",
"ja": "コロンビア",
"it": "Colombia",
"hu": "Kolumbia"
},
"flags": [
"https://restcountries.com/data/col.svg",
"https://restcountries.com/data/png/col.png"
],
"regionalBlocs": [
{
"acronym": "PA",
"name": "Pacific Alliance",
"otherNames": [
"Alianza del Pacífico"
]
},
{
"acronym": "USAN",
"name": "Union of South American Nations",
"otherAcronyms": [
"UNASUR",
"UNASUL",
"UZAN"
],
"otherNames": [
"Unión de Naciones Suramericanas",
"União de Nações Sul-Americanas",
"Unie van Zuid-Amerikaanse Naties",
"South American Union"
]
}
],
"cioc": "COL",
"independent": true
}
```
Filter Response
=======
You can filter the output of your request to include only the specified fields.
``` javascript
https://restcountries.com/v2/{service}?fields={field},{field},{field}
```
``` html
https://restcountries.com/v2/all?fields=name,capital,currencies
```
Sources
=======
* [@mledoze]
* [List of countries]
* [Languages]
* [Currencies]
* [Area]
Similar projects
=======
* [Original Project]
* [Countries of the world]
* [REST Countries Node.js]
* [REST Countries Ruby]
* [REST Countries Go]
* [REST Countries Python]
* [world-currencies]
License
=======
[Mozilla Public License] MPL 2.0
[$5]:https://www.paypal.com/paypalme/amatosg/5
[$10]:https://www.paypal.com/paypalme/amatosg/10
[$15]:https://www.paypal.com/paypalme/amatosg/15
[more]:https://www.paypal.com/paypalme/amatosg/
[Original Project]: https://github.com/apilayer/restcountries/
[@mledoze]: https://github.com/mledoze/countries
[List of countries]: https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes
[Languages]: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
[Currencies]: https://en.wikipedia.org/wiki/List_of_circulating_currencies
[Area]: https://en.wikipedia.org/wiki/List_of_countries_and_dependencies_by_area
[Population]: https://en.wikipedia.org/wiki/List_of_countries_by_population
[Gini coefficient]: http://en.wikipedia.org/wiki/List_of_countries_by_income_equality
[Mozilla Public License]: https://www.mozilla.org/en-US/MPL/2.0/
[world-currencies]: https://github.com/wiredmax/world-currencies
[REST Countries Node.js]: https://github.com/aredo/restcountries
[REST Countries Ruby]: https://github.com/davidesantangelo/restcountry
[REST Countries Go]: https://github.com/alediaferia/gocountries
[REST Countries Python]: https://github.com/SteinRobert/python-restcountries
[Countries of the world]: http://countries.petethompson.net
[TTÜ]: https://www.ttu.ee/studying/tut_admission/programmes-in-tut/ask-us/
[Spotify International Pricing Index]: http://mts.io/2014/05/07/spotify-pricing-index/
[Gorillaz]: http://www.gorillaz.com/
[Wanderlust]: https://wanderlust.com/
[Xero]: https://www.xero.com/
[FxPro]: http://www.fxpro.com/
[onefinestay]: https://www.onefinestay.com/
[Much Better Adventures]: https://www.muchbetteradventures.com
[SKROSS]: http://www.skross.com/en
+59 -6
View File
@@ -1,10 +1,63 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset='utf-8'>
<title>Title</title> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<title>REST Countries</title>
<!-- Flatdoc -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src='https://cdn.rawgit.com/rstacruz/flatdoc/v0.9.0/legacy.js'></script>
<script src='https://cdn.rawgit.com/rstacruz/flatdoc/v0.9.0/flatdoc.js'></script>
<!-- Flatdoc theme -->
<link href='https://cdn.rawgit.com/rstacruz/flatdoc/v0.9.0/theme-white/style.css' rel='stylesheet'>
<script src='https://cdn.rawgit.com/rstacruz/flatdoc/v0.9.0/theme-white/script.js'></script>
<!-- Meta -->
<meta content="REST Countries" property="og:title">
<meta content="Get information about countries via a RESTful API" name="description">
<meta name="keywords" content="rest,api,countries,world,json">
<meta name="author" content="Fayder Florez">
<!-- Custom -->
<link rel="shortcut icon" href="img/favicon.ico" />
<script src="https://checkout.stripe.com/checkout.js"></script>
<!-- Initializer -->
<script>
Flatdoc.run({
fetcher: Flatdoc.file('flatdoc.md')
});
</script>
<style type="text/css" media="screen">
body {
font-family: Verdana, sans-serif;
}
</style>
</head> </head>
<body> <body role='flatdoc'>
hola mundo
<div class='header'>
<div class='left'>
<h1>REST Countries</h1>
<ul>
<li><a href='https://github.com/apilayer/restcountries'>View on GitHub</a></li>
<li><a href='https://github.com/apilayer/restcountries/issues'>Issues</a></li>
</ul>
</div>
</div>
<div class='content-root'>
<div class='menubar'>
<div class='menu section' role='flatdoc-menu'></div>
</div>
<div role='flatdoc-content' class='content'></div>
</div>
<script src="js/restc.min.js" type="text/javascript" charset="utf-8" async defer></script>
</body> </body>
</html> </html>
File diff suppressed because one or more lines are too long
+111
View File
@@ -0,0 +1,111 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var restc = restc || {};
$(function () {
'use strict';
$(document).on('flatdoc:ready', function() {
if (location.hostname != "localhost" && location.hostname != "127.0.0.1" && location.protocol != 'https:') {
location.href = location.href.replace("http://", "https://");
}
var stripeHandler = StripeCheckout.configure({
key: 'pk_live_lKuAMSLFxniueaO1AcVD81HB',
image: 'https://restcountries.eu/img/rc-icon.png',
locale: 'auto',
billingAddress: true,
panelLabel: 'Contribute',
token: function(token) {
// You can access the token ID with `token.id`.
// Get the token ID to your server-side code for use.
$.ajax({
url: 'https://restcountries.eu/rest/contribute',
type: 'POST',
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify({"token": token.id, "amount": restc.amount}),
success: function(data, textStatus, jqXHR) {
console.log("Contribution success");
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(textStatus);
alert("Your contribution failed. Please contact support@restcountries.eu");
}
});
}
});
$('a[href="#five"]').click(function(e) {
stripeHandler.open({
name: 'REST Countries',
description: 'Secured by Stripe',
currency: 'eur',
amount: 500
});
restc.amount = 500;
e.preventDefault();
});
$('a[href="#ten"]').click(function(e) {
stripeHandler.open({
name: 'REST Countries',
description: 'Secured by Stripe',
currency: 'eur',
amount: 1000
});
restc.amount = 1000;
e.preventDefault();
});
$('a[href="#twenty"]').click(function(e) {
stripeHandler.open({
name: 'REST Countries',
description: 'Secured by Stripe',
currency: 'eur',
amount: 2000
});
restc.amount = 2000;
e.preventDefault();
});
$('a[href="#fifty"]').click(function(e) {
stripeHandler.open({
name: 'REST Countries',
description: 'Secured by Stripe',
currency: 'eur',
amount: 5000
});
restc.amount = 5000;
e.preventDefault();
});
$('a[href="#seventy"]').click(function(e) {
stripeHandler.open({
name: 'REST Countries',
description: 'Secured by Stripe',
currency: 'eur',
amount: 7000
});
restc.amount = 7000;
e.preventDefault();
});
$('a[href="#hundred"]').click(function(e) {
stripeHandler.open({
name: 'REST Countries',
description: 'Secured by Stripe',
currency: 'eur',
amount: 10000
});
restc.amount = 10000;
e.preventDefault();
});
// Close Checkout on page navigation:
window.addEventListener('popstate', function() {
stripeHandler.close();
});
});
});
+1
View File
@@ -0,0 +1 @@
var restc=restc||{};$(function(){'use strict';$(document).on('flatdoc:ready',function(){var stripeHandler=StripeCheckout.configure({key:'pk_live_lKuAMSLFxniueaO1AcVD81HB',image:'https://restcountries.eu/img/rc-icon.png',locale:'auto',billingAddress:true,panelLabel:'Contribute',token:function(token){$.ajax({url:'https://restcountries.eu/rest/contribute',type:'POST',contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({"token":token.id,"amount":restc.amount}),success:function(data,textStatus,jqXHR){console.log("Contribution success")},error:function(jqXHR,textStatus,errorThrown){console.log(textStatus);alert("Your contribution failed. Please contact support@restcountries.eu")}})}});$('a[href="#five"]').click(function(e){stripeHandler.open({name:'REST Countries',description:'Secured by Stripe',currency:'eur',amount:500});restc.amount=500;e.preventDefault()});$('a[href="#ten"]').click(function(e){stripeHandler.open({name:'REST Countries',description:'Secured by Stripe',currency:'eur',amount:1000});restc.amount=1000;e.preventDefault()});$('a[href="#twenty"]').click(function(e){stripeHandler.open({name:'REST Countries',description:'Secured by Stripe',currency:'eur',amount:2000});restc.amount=2000;e.preventDefault()});$('a[href="#fifty"]').click(function(e){stripeHandler.open({name:'REST Countries',description:'Secured by Stripe',currency:'eur',amount:5000});restc.amount=5000;e.preventDefault()});$('a[href="#seventy"]').click(function(e){stripeHandler.open({name:'REST Countries',description:'Secured by Stripe',currency:'eur',amount:7000});restc.amount=7000;e.preventDefault()});$('a[href="#hundred"]').click(function(e){stripeHandler.open({name:'REST Countries',description:'Secured by Stripe',currency:'eur',amount:10000});restc.amount=10000;e.preventDefault()});window.addEventListener('popstate',function(){stripeHandler.close()})})});