forked from sagarkarira/coronavirus-tracker-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.js
More file actions
127 lines (91 loc) · 3.66 KB
/
constants.js
File metadata and controls
127 lines (91 loc) · 3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
const { htmlTemplate, footer } = require('./helpers');
exports.helpContent = `
/$$ /$$ /$$$$$$$$ /$$ /$$$$$$$
| $$ | $$| $$_____/| $$ | $$____$$
| $$ | $$| $$ | $$ | $$ $$
| $$$$$$$$| $$$$$ | $$ | $$$$$$$/
| $$__ $$| $$__/ | $$ | $$____/
| $$ | $$| $$ | $$ | $$
| $$ | $$| $$$$$$$$| $$$$$$$$| $$
|__/ |__/|________/|________/|__/
---------------------------------------------------------------------------------
# Source 1 stats - updated once a day from John Hopkins University
https://corona-stats.online
---------------------------------------------------------------------------------
(DEFAULT SOURCE)
# Source 2 stats - updated every 15 minutes from worldometers.info
https://corona-stats.online?source=2
---------------------------------------------------------------------------------
# Country wise stats
## Format:
https://corona-stats.online/[countryCode]
https://corona-stats.online/[countryName]
## Example: From source 1
https://corona-stats.online/Italy?source=1
https://corona-stats.online/UK?source=1
## Example: From source 2 (DEFAULT)
https://corona-stats.online/italy
https://corona-stats.online/italy?source=2
https://corona-stats.online/UK?source=2
https://corona-stats.online/UK
---------------------------------------------------------------------------------
# State wise api (Only for US as of now)
## Format:
https://corona-stats.online/states/[countryCode]
https://corona-stats.online/states/[countryName]
## Example: From source 1
https://corona-stats.online/us
https://corona-stats.online/USA?format=json
https://corona-stats.online/USA?minimal=true
---------------------------------------------------------------------------------
# Minimal Mode - remove the borders and padding from table
## Example:
https://corona-stats.online?minimal=true
https://corona-stats.online/Italy?minimal=true (with country filter)
https://corona-stats.online?minimal=true&source=1 (with source)
https://corona-stats.online/uk?source=2&minimal=true (with source and country)
---------------------------------------------------------------------------------
# Get data as JSON - Add ?format=json
## Example:
https://corona-stats.online?format=json
https://corona-stats.online/Italy?format=json (with country filter)
https://corona-stats.online/?source=2&format=json (with source)
https://corona-stats.online/uk?source=2&format=json (with source and country)
---------------------------------------------------------------------------------
# Get top N countries - Add ?top=N
## Example:
https://corona-stats.online?top=25
https://corona-stats.online?source=1&top=10 (with source)
https://corona-stats.online/uk?minimal=true&top=20 (with minimal)
---------------------------------------------------------------------------------
# Confirmed Cases Graph (WIP)
## Format:
https://corona-stats.online/[countryName]/graph
https://corona-stats.online/[countryCode]/graph
## Example:
https://corona-stats.online/italy/graph
https://corona-stats.online/china/graph
------------- Any issues or feedback - Hit me up on twitter @ekrysis --------------
`;
exports.countryNotFound = (isCurl) => {
const body = `
Country not found.
Try the full country name or country code.
Example:
- /UK: for United Kingdom
- /US: for United States of America.
- /Italy: for Italy.
${footer(new Date)}
`;
return isCurl ? body : htmlTemplate(body);
};
exports.stateCountryNotFound = (isCurl) => {
const body = `
State wise api is only available for:
- US
Try:
/US or /USA
${footer(new Date)}
`;
return isCurl ? body : htmlTemplate(body);
};