11const { htmlTemplate, footer } = require ( './helpers' ) ;
2- exports . countryNameMap = {
3- China : 'CN' ,
4- UK : 'GB' ,
5- Martinique : 'MQ' ,
6- Liechtenstein : 'LI' ,
7- 'Réunion' : 'RE' ,
8- Ukraine : 'UA' ,
9- Honduras : 'HN' ,
10- Afghanistan : 'AF' ,
11- Bangladesh : 'BD' ,
12- Macao : 'MO' ,
13- Bolivia : 'BO' ,
14- Cuba : 'CU' ,
15- Netherlands : 'NL' ,
16- Jamaica : 'JM' ,
17- 'French Guiana' : 'GF' ,
18- DRC : 'CD' ,
19- Cameroon : 'CM' ,
20- Maldives : 'MV' ,
21- Montenegro : 'ME' ,
22- Paraguay : 'PY' ,
23- Nigeria : 'NG' ,
24- Guam : 'GU' ,
25- 'French Polynesia' : 'PF' ,
26- Austria : 'AT' ,
27- Ghana : 'GH' ,
28- Rwanda : 'RW' ,
29- Monaco : 'MC' ,
30- Gibraltar : 'GI' ,
31- Guatemala : 'GT' ,
32- 'Ivory Coast' : 'CI' ,
33- Ethiopia : 'ET' ,
34- Togo : 'TG' ,
35- 'Trinidad and Tobago' : 'TT' ,
36- Kenya : 'KE' ,
37- Belgium : 'BE' ,
38- Mauritius : 'MU' ,
39- 'Equatorial Guinea' : 'GQ' ,
40- Kyrgyzstan : 'KG' ,
41- Mongolia : 'MN' ,
42- 'Puerto Rico' : 'PR' ,
43- Seychelles : 'SC' ,
44- Tanzania : 'TZ' ,
45- Guyana : 'GY' ,
46- Aruba : 'AW' ,
47- Barbados : 'BB' ,
48- Norway : 'NO' ,
49- Mayotte : 'YT' ,
50- 'Cayman Islands' : 'KY' ,
51- 'Curaçao' : 'CW' ,
52- Bahamas : 'BS' ,
53- Congo : 'CD' ,
54- Gabon : 'GA' ,
55- Namibia : 'NA' ,
56- 'St. Barth' : 'BL' ,
57- 'Saint Martin' : 'MF' ,
58- 'U.S. Virgin Islands' : 'VI' ,
59- Sweden : 'SE' ,
60- Sudan : 'SD' ,
61- Benin : 'BJ' ,
62- Bermuda : 'BM' ,
63- Bhutan : 'BT' ,
64- CAR : 'CF' ,
65- Greenland : 'GL' ,
66- Haiti : 'HT' ,
67- Liberia : 'LR' ,
68- Mauritania : 'MR' ,
69- 'New Caledonia' : 'NC' ,
70- Denmark : 'DK' ,
71- 'Saint Lucia' : 'LC' ,
72- Zambia : 'ZM' ,
73- Nepal : 'NP' ,
74- Angola : 'AO' ,
75- 'Antigua and Barbuda' : 'AG' ,
76- 'Cabo Verde' : 'CV' ,
77- Chad : 'TD' ,
78- Djibouti : 'DJ' ,
79- 'El Salvador' : 'SV' ,
80- Fiji : 'FJ' ,
81- Japan : 'JP' ,
82- Gambia : 'GM' ,
83- Guinea : 'GN' ,
84- 'Vatican City' : 'VA' ,
85- 'Isle of Man' : 'IM' ,
86- Montserrat : 'MS' ,
87- Nicaragua : 'NI' ,
88- Niger : 'NE' ,
89- 'St. Vincent Grenadines' : 'VC' ,
90- 'Sint Maarten' : 'SX' ,
91- Somalia : 'SO' ,
92- Malaysia : 'MY' ,
93- Suriname : 'SR' ,
94- Eswatini : 'SZ' ,
95- Australia : 'AU' ,
96- Italy : 'IT' ,
97- Canada : 'CA' ,
98- Portugal : 'PT' ,
99- Czechia : 'CZ' ,
100- Israel : 'IL' ,
101- Brazil : 'BR' ,
102- Luxembourg : 'LU' ,
103- Ireland : 'IE' ,
104- Greece : 'GR' ,
105- Qatar : 'QA' ,
106- Pakistan : 'PK' ,
107- Iran : 'IR' ,
108- Finland : 'FI' ,
109- Poland : 'PL' ,
110- Turkey : 'TR' ,
111- Singapore : 'SG' ,
112- Chile : 'CL' ,
113- Iceland : 'IS' ,
114- Thailand : 'TH' ,
115- Slovenia : 'SI' ,
116- Indonesia : 'ID' ,
117- Bahrain : 'BH' ,
118- Spain : 'ES' ,
119- Romania : 'RO' ,
120- 'Saudi Arabia' : 'SA' ,
121- Estonia : 'EE' ,
122- Ecuador : 'EC' ,
123- Egypt : 'EG' ,
124- Peru : 'PE' ,
125- Philippines : 'PH' ,
126- 'Hong Kong' : 'HK' ,
127- India : 'IN' ,
128- Russia : 'RU' ,
129- Germany : 'DE' ,
130- Iraq : 'IQ' ,
131- Mexico : 'MX' ,
132- Lebanon : 'LB' ,
133- 'South Africa' : 'ZA' ,
134- Kuwait : 'KW' ,
135- 'San Marino' : 'SM' ,
136- UAE : 'AE' ,
137- Panama : 'PA' ,
138- Armenia : 'AM' ,
139- Taiwan : 'TW' ,
140- USA : 'US' ,
141- Argentina : 'AR' ,
142- Colombia : 'CO' ,
143- Slovakia : 'SK' ,
144- Serbia : 'RS' ,
145- Croatia : 'HR' ,
146- Bulgaria : 'BG' ,
147- Uruguay : 'UY' ,
148- Algeria : 'DZ' ,
149- 'Costa Rica' : 'CR' ,
150- Latvia : 'LV' ,
151- France : 'FR' ,
152- Hungary : 'HU' ,
153- Vietnam : 'VN' ,
154- 'Faeroe Islands' : 'FO' ,
155- Andorra : 'AD' ,
156- Brunei : 'BN' ,
157- Belarus : 'BY' ,
158- Jordan : 'JO' ,
159- Cyprus : 'CY' ,
160- 'Sri Lanka' : 'LK' ,
161- Albania : 'AL' ,
162- 'S. Korea' : 'KR' ,
163- 'Bosnia and Herzegovina' : 'BA' ,
164- Morocco : 'MA' ,
165- Malta : 'MT' ,
166- 'North Macedonia' : 'MK' ,
167- Moldova : 'MD' ,
168- Kazakhstan : 'KZ' ,
169- Lithuania : 'LT' ,
170- Oman : 'OM' ,
171- Cambodia : 'KH' ,
172- Palestine : 'PS' ,
173- Switzerland : 'CH' ,
174- Guadeloupe : 'GP' ,
175- Azerbaijan : 'AZ' ,
176- Georgia : 'GE' ,
177- Venezuela : 'VE' ,
178- Tunisia : 'TN' ,
179- 'New Zealand' : 'NZ' ,
180- Senegal : 'SN' ,
181- 'Dominican Republic' : 'DO' ,
182- 'Burkina Faso' : 'BF' ,
183- Uzbekistan : 'UZ' ,
184- 'Madagascar' : 'MG' ,
185- 'Uganda' : 'UG' ,
186- 'Zimbabwe' : 'ZW' ,
187- 'Dominica' : 'DM' ,
188- 'Laos' : 'LA' ,
189- 'Myanmar' : 'MM' ,
190- 'Belize' : 'BZ' ,
191- 'Eritrea' : 'ER' ,
192- 'Grenada' : 'GD' ,
193- 'Mozambique' : 'MZ' ,
194- 'Papua New Guinea' : 'PG' ,
195- 'Syria' : 'SY' ,
196- 'Timor-Leste' : 'TL' ,
197- 'Turks and Caicos' : 'TC'
198- } ;
1992
2003exports . helpContent = `
2014
@@ -239,6 +42,19 @@ https://corona-stats.online/UK
23942
24043---------------------------------------------------------------------------------
24144
45+ # State wise api (Only for US as of now)
46+
47+ ## Format:
48+ https://corona-stats.online/states/[countryCode]
49+ https://corona-stats.online/states/[countryName]
50+
51+ ## Example: From source 1
52+ https://corona-stats.online/us
53+ https://corona-stats.online/USA?format=json
54+ https://corona-stats.online/USA?minimal=true
55+
56+ ---------------------------------------------------------------------------------
57+
24258# Minimal Mode - remove the borders and padding from table
24359
24460## Example:
@@ -296,4 +112,16 @@ exports.countryNotFound = (isCurl) => {
296112 ${ footer ( new Date ) }
297113 ` ;
298114 return isCurl ? body : htmlTemplate ( body ) ;
115+ } ;
116+
117+ exports . stateCountryNotFound = ( isCurl ) => {
118+ const body = `
119+ State wise api is only available for:
120+ - US
121+ Try:
122+ /US or /USA
123+
124+ ${ footer ( new Date ) }
125+ ` ;
126+ return isCurl ? body : htmlTemplate ( body ) ;
299127} ;
0 commit comments