Skip to content

Commit dc315b7

Browse files
committedAug 12, 2022
Get Datawrapper API key from ENV #12
1 parent 75f87df commit dc315b7

8 files changed

+3724
-1168
lines changed
 

‎.env.template

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DATAWRAPPER_API_KEY=<TOKEN>

‎.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Project
2-
config.json
3-
config.backup.json
2+
.env
43
template.html
54

65
# Node

‎charts.json

+226
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
[
2+
{
3+
"id": "aY5t8",
4+
"title": "Corona-Inzidenz in Deutschland (Symbolkarte)",
5+
"description": "Gemeldete Corona-Neuinfektionen in Deutschland pro 100.000 Einwohner in den vergangenen 7 Tagen",
6+
"csvUrl": "https://storage.googleapis.com/brdata-public-data/corona-data-workers/landkreise_deutschland.csv",
7+
"height": 700
8+
},
9+
{
10+
"id": "A84EA",
11+
"title": "Corona-Fälle in Deutschland",
12+
"description": "Entwicklung der gemeldeten Fallzahlen (logarithmisch)",
13+
"csvUrl": "https://corona-deutschland-api.interaktiv.br.de/query?startDate=2020-02-25&dateField=Refdatum&filetype=csv",
14+
"height": 400
15+
},
16+
{
17+
"id": "pKz1y",
18+
"title": "Corona-Fälle in Deutschland",
19+
"description": "Entwicklung der gemeldeten Fallzahlen",
20+
"csvUrl": "https://corona-deutschland-api.interaktiv.br.de/query?startDate=2020-02-25&dateField=Refdatum&filetype=csv",
21+
"height": 400
22+
},
23+
{
24+
"id": "FO8IT",
25+
"title": "Wie viele neue Fälle gibt es in Deutschland täglich?",
26+
"description": "Bestätigte Corona-Neuinfektionen nach Meldedatum mit 7-Tage Mittel",
27+
"csvUrl": "https://corona-api.interaktiv.br.de/query/infektionen-de?sort=meldedatum&fieldList=meldedatum,anzahlFall,mittlere7TageInfektionen",
28+
"height": 400
29+
},
30+
{
31+
"id": "XiHIr",
32+
"title": "Corona-Inzidenz nach Altergruppen in Deutschland",
33+
"description": "Gemeldete Corona-Neuinfektionen pro 100.000 Einwohner in den jeweils vergangenen 7 Tagen nach Alter",
34+
"csvUrl": "https://storage.googleapis.com/brdata-public-data/corona-data-workers/altersverteilung.csv",
35+
"height": 350
36+
},
37+
{
38+
"id": "jrkvL",
39+
"title": "Intensivpatienten in Deutschland",
40+
"description": "Zahl der gemeldeten Corona-Fälle in intensivmedizinischer Behandlung",
41+
"csvUrl": "https://corona-api.interaktiv.br.de/query/intensivpatienten-de?sort=datum&fieldList=datum,anzahlIntensivpatienten",
42+
"height": 400
43+
},
44+
{
45+
"id": "NG2nH",
46+
"title": "Anteil der Corona-Infizierten an der Bevölkerung",
47+
"description": "",
48+
"csvUrl": "https://docs.google.com/spreadsheets/d/1CcexpVxfgBnQdOKV_KXOzptNDuqB6E0Z6B9RFLq2dp4/export?format=csv&gid=590463298",
49+
"height": 200
50+
},
51+
{
52+
"id": "7LLPz",
53+
"title": "Impffortschritt in Bayern und Deutschland",
54+
"description": "Bevölkerung nach Zahl der verabreichten Impfdosen",
55+
"csvUrl": "https://docs.google.com/spreadsheets/d/14PzAA3k1cm_Y6jOPRIFHlBXyqDFnAsGLJHlX4yRAFAw/export?format=csv&id=14PzAA3k1cm_Y6jOPRIFHlBXyqDFnAsGLJHlX4yRAFAw&gid=1140721593",
56+
"height": 200
57+
},
58+
{
59+
"id": "tavHE",
60+
"title": "Corona-Impfung in Deutschland und Bayern",
61+
"description": "Wählen Sie aus: Aktueller <a target='_self' href=' https://datawrapper.dwcdn.net/tavHE' style='background:#0b9fd8; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;' rel='nofollow noopener noreferrer'>Stand</a>&nbsp;|&nbsp;Entwicklung der Zahl der Geimpften in <a target='_self' href='https://datawrapper.dwcdn.net/IhAG6' style='background:#0b9fd8; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;' rel='nofollow noopener noreferrer'>Bayern</a> und <a target='_self' href='https://datawrapper.dwcdn.net/8CyAL' style='background:#0b9fd8; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;' rel='nofollow noopener noreferrer'>Deutschland</a>",
62+
"csvUrl": "https://docs.google.com/spreadsheets/d/1yahYgba16ujYg2z1VSKSGprsUdzbQUXWNAFZodOYZfU/export?format=csv&id=1yahYgba16ujYg2z1VSKSGprsUdzbQUXWNAFZodOYZfU&gid=85813540",
63+
"height": 300
64+
},
65+
{
66+
"id": "8CyAL",
67+
"title": "Entwicklung der Corona-Impfungen in Deutschland",
68+
"description": "<p>Wählen Sie aus: Aktueller <a target='_self' href='https://datawrapper.dwcdn.net/tavHE' style='background:#0b9fd8; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;'>Stand</a>&nbsp;|&nbsp;Entwicklung der Zahl der Geimpften in <a target='_self' href='https://datawrapper.dwcdn.net/IhAG6' style='background:#0b9fd8; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;'>Bayern</a> und <a target='_self' href='https://datawrapper.dwcdn.net/8CyAL' style='background:#0b9fd8; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;'>Deutschland</a></p>",
69+
"csvUrl": "https://docs.google.com/spreadsheets/d/1yahYgba16ujYg2z1VSKSGprsUdzbQUXWNAFZodOYZfU/export?format=csv&id=1yahYgba16ujYg2z1VSKSGprsUdzbQUXWNAFZodOYZfU&gid=2001954630",
70+
"height": 400
71+
},
72+
{
73+
"id": "IhAG6",
74+
"title": "Entwicklung der Corona-Impfungen in Bayern",
75+
"description": "<p>Wählen Sie aus: Aktueller <a target='_self' href='https://datawrapper.dwcdn.net/tavHE' style='background:#0b9fd8; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;'>Stand</a>&nbsp;|&nbsp;Entwicklung der Zahl der Geimpften in <a target='_self' href='https://datawrapper.dwcdn.net/IhAG6' style='background:#0b9fd8; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;'>Bayern</a> und <a target='_self' href='https://datawrapper.dwcdn.net/8CyAL' style='background:#0b9fd8; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;'>Deutschland</a></p>",
76+
"csvUrl": "https://docs.google.com/spreadsheets/d/1yahYgba16ujYg2z1VSKSGprsUdzbQUXWNAFZodOYZfU/export?format=csv&id=1yahYgba16ujYg2z1VSKSGprsUdzbQUXWNAFZodOYZfU&gid=1959918300",
77+
"height": 400
78+
},
79+
{
80+
"id": "QKKta",
81+
"title": "Verteilung der Impfdosen in Bayern",
82+
"description": "Anteil der verabreichten Impfdosen nach dem Grund der Impfung",
83+
"csvUrl": "https://docs.google.com/spreadsheets/d/1yahYgba16ujYg2z1VSKSGprsUdzbQUXWNAFZodOYZfU/export?format=csv&gid=1046981025",
84+
"height": 600
85+
},
86+
{
87+
"id": "xB5Pf",
88+
"title": "Corona-Inzidenz in Bayern (Tabelle)",
89+
"description": "Gemeldete Corona-Fälle, 7-Tage-Inzidenz und gemeldete Todesfälle in den bayerischen Landkreisen",
90+
"csvUrl": "https://storage.googleapis.com/brdata-public-data/corona-data-workers/landkreiskarte_bayern.csv",
91+
"height": 400
92+
},
93+
{
94+
"id": "rf5H5",
95+
"title": "Corona-Inzidenz in Bayern (Symbolkarte)",
96+
"description": "Größe und Farbe der Punkte zeigen die gemeldeten Corona-Neuinfektionen in Bayern pro 100.000 Einwohnern in den vergangenen 7 Tagen.",
97+
"csvUrl": "https://storage.googleapis.com/brdata-public-data/corona-data-workers/landkreiskarte_bayern.csv",
98+
"height": 700
99+
},
100+
{
101+
"id": "eij5b",
102+
"title": "Corona-Fälle in Bayern",
103+
"description": "Entwicklung der gemeldeten Fallzahlen",
104+
"csvUrl": "https://corona-deutschland-api.interaktiv.br.de/query?startDate=2020-02-25&dateField=Refdatum&bundesland=Bayern&filetype=csv",
105+
"height": 400
106+
},
107+
{
108+
"id": "4zOBp",
109+
"title": "Wie viele neue Fälle gibt es in Bayern täglich?",
110+
"description": "Bestätigte Corona-Neuinfektionen nach Meldedatum mit 7-Tage Mittel",
111+
"csvUrl": "https://corona-api.interaktiv.br.de/query/infektionen-bl?filter=bundesland==Bayern&sort=meldedatum&fieldList=meldedatum,anzahlFall,mittlere7TageInfektionen",
112+
"height": 400
113+
},
114+
{
115+
"id": "NWcZ8",
116+
"title": "Corona-Inzidenz nach Altersgruppen in Bayern",
117+
"description": "Gemeldete Corona-Neuinfektionen pro 100.000 Einwohner in den jeweils vergangenen 7 Tagen nach Alter",
118+
"csvUrl": "https://storage.googleapis.com/brdata-public-data/corona-data-workers/altersverteilung_bayern.csv",
119+
"height": 350
120+
},
121+
{
122+
"id": "MCha4",
123+
"title": "Intensivpatienten in Bayern",
124+
"description": "Zahl der gemeldeten Corona-Fälle in intensivmedizinischer Behandlung",
125+
"csvUrl": "https://corona-api.interaktiv.br.de/query/intensivpatienten-bl?filter=bundesland==Bayern&sort=datum&fieldList=datum,anzahlIntensivpatienten",
126+
"height": 400
127+
},
128+
{
129+
"id": "FYgL4",
130+
"title": "Wie viele Corona-Patienten werden in Bayern hospitalisiert?",
131+
"description": "Hospitalisierte Covid-19-Fälle in Bayern pro 100.000 Einwohner in den vergangenen 7 Tagen nach Meldedatum der Erkrankung",
132+
"csvUrl": "https://docs.google.com/spreadsheets/d/1NbPIWxPTSWuJzAs4Zf120t-Y_X-9UA8BlKeqVu-I1A4/export?format=csv&id=1NbPIWxPTSWuJzAs4Zf120t-Y_X-9UA8BlKeqVu-I1A4&gid=1893489882",
133+
"height": 400
134+
},
135+
{
136+
"id": "6K6b3",
137+
"title": "Wie viele Corona-Patienten werden in Deutschland hospitalisiert?",
138+
"description": "Hospitalisierte Covid-19-Fälle in Deutschland pro 100.000 Einwohner in den vergangenen 7 Tagen nach Meldedatum der Erkrankung",
139+
"csvUrl": "https://docs.google.com/spreadsheets/d/1NbPIWxPTSWuJzAs4Zf120t-Y_X-9UA8BlKeqVu-I1A4/export?format=csv&id=1NbPIWxPTSWuJzAs4Zf120t-Y_X-9UA8BlKeqVu-I1A4&gid=1175154031",
140+
"height": 400
141+
},
142+
{
143+
"id": "qsvOD",
144+
"title": "Corona-Fälle in Franken",
145+
"description": "Entwicklung der gemeldeten Fälle pro Tag",
146+
"csvUrl": "https://corona-deutschland-api.interaktiv.br.de/query?startDate=2020-02-25&dateField=Refdatum&group=Regierungsbezirk&bundesland=Bayern&regierungsbezirk=Mittelfranken,Oberfranken,Unterfranken&filetype=csv",
147+
"height": 400
148+
},
149+
{
150+
"id": "YJEKE",
151+
"title": "Neue Corona-Fälle in Mittelfranken",
152+
"description": "Bestätigte Neuinfektionen nach Meldedatum mit 7-Tage Mittel. Wählen Sie Ihren Regierungsbezirk aus: <br><a target='_self' href='https://datawrapper.dwcdn.net/yhhUL' style='display:inline-block; background:#0b9fd8; margin:5px 0; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;'>Unterfranken</a>&nbsp;<a target='_self' href='https://datawrapper.dwcdn.net/YJEKE' style='display:inline-block; background:#0b9fd8; margin:5px 0; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;'>Mittelfranken</a>&nbsp;<a target='_self' href='https://datawrapper.dwcdn.net/1gwLV' style='display:inline-block; background:#0b9fd8; margin:5px 0; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;'>Oberfranken</a>",
153+
"csvUrl": "https://corona-api.interaktiv.br.de/query/infektionen-rb?filter=regierungsbezirk==Mittelfranken&sort=meldedatum&fieldList=meldedatum,anzahlFall,mittlere7TageInfektionen",
154+
"height": 400
155+
},
156+
{
157+
"id": "yhhUL",
158+
"title": "Neue Corona-Fälle in Unterfranken",
159+
"description": "Bestätigte Neuinfektionen nach Meldedatum mit 7-Tage Mittel. Wählen Sie Ihren Regierungsbezirk aus: <br><a target='_self' href='https://datawrapper.dwcdn.net/yhhUL' style='display:inline-block; background:#0b9fd8; margin:5px 0; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;'>Unterfranken</a>&nbsp;<a target='_self' href='https://datawrapper.dwcdn.net/YJEKE' style='display:inline-block; background:#0b9fd8; margin:5px 0; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;'>Mittelfranken</a>&nbsp;<a target='_self' href='https://datawrapper.dwcdn.net/1gwLV' style='display:inline-block; background:#0b9fd8; margin:5px 0; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;'>Oberfranken</a>",
160+
"csvUrl": "https://corona-api.interaktiv.br.de/query/infektionen-rb?filter=regierungsbezirk==Unterfranken&sort=meldedatum&fieldList=meldedatum,anzahlFall,mittlere7TageInfektionen",
161+
"height": 400
162+
},
163+
{
164+
"id": "1gwLV",
165+
"title": "Neue Corona-Fälle in Oberfranken",
166+
"description": "Bestätigte Neuinfektionen nach Meldedatum mit 7-Tage Mittel. Wählen Sie Ihren Regierungsbezirk aus: <br><a target='_self' href='https://datawrapper.dwcdn.net/yhhUL' style='display:inline-block; background:#0b9fd8; margin:5px 0; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;'>Unterfranken</a>&nbsp;<a target='_self' href='https://datawrapper.dwcdn.net/YJEKE' style='display:inline-block; background:#0b9fd8; margin:5px 0; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;'>Mittelfranken</a>&nbsp;<a target='_self' href='https://datawrapper.dwcdn.net/1gwLV' style='display:inline-block; background:#0b9fd8; margin:5px 0; padding:1px 6px; border-radius:5px; color:#ffffff; cursor:pointer;'>Oberfranken</a>",
167+
"csvUrl": "https://corona-api.interaktiv.br.de/query/infektionen-rb?filter=regierungsbezirk==Oberfranken&sort=meldedatum&fieldList=meldedatum,anzahlFall,mittlere7TageInfektionen",
168+
"height": 400
169+
},
170+
{
171+
"id": "Hgr9p",
172+
"title": "Corona-Fälle in Oberbayern",
173+
"description": "Entwicklung der gemeldeten Fälle pro Tag",
174+
"csvUrl": "https://corona-deutschland-api.interaktiv.br.de/query?startDate=2020-02-25&dateField=Refdatum&group=Regierungsbezirk&bundesland=Bayern&regierungsbezirk=Oberbayern&filetype=csv",
175+
"height": 400
176+
},
177+
{
178+
"id": "3oluk",
179+
"title": "Neue Corona-Fälle in Oberbayern",
180+
"description": "Bestätigte Corona-Neuinfektionen nach Meldedatum mit 7-Tage Mittel",
181+
"csvUrl": "https://corona-api.interaktiv.br.de/query/infektionen-rb?filter=regierungsbezirk==Oberbayern&sort=meldedatum&fieldList=meldedatum,anzahlFall,mittlere7TageInfektionen",
182+
"height": 400
183+
},
184+
{
185+
"id": "e2UmU",
186+
"title": "Corona-Fälle in Niederbayern",
187+
"description": "Entwicklung der gemeldeten Fälle pro Tag",
188+
"csvUrl": "https://corona-deutschland-api.interaktiv.br.de/query?startDate=2020-02-25&dateField=Refdatum&group=Regierungsbezirk&bundesland=Bayern&regierungsbezirk=Niederbayern&filetype=csv",
189+
"height": 400
190+
},
191+
{
192+
"id": "hWw8L",
193+
"title": "Neue Corona-Fälle in Niederbayern",
194+
"description": "Bestätigte Corona-Neuinfektionen nach Meldedatum mit 7-Tage Mittel",
195+
"csvUrl": "https://corona-api.interaktiv.br.de/query/infektionen-rb?filter=regierungsbezirk==Niederbayern&sort=meldedatum&fieldList=meldedatum,anzahlFall,mittlere7TageInfektionen",
196+
"height": 400
197+
},
198+
{
199+
"id": "5I8vc",
200+
"title": "Corona-Fälle in Oberpfalz",
201+
"description": "Entwicklung der gemeldeten Fälle pro Tag",
202+
"csvUrl": "https://corona-deutschland-api.interaktiv.br.de/query?startDate=2020-02-25&dateField=Refdatum&group=Regierungsbezirk&bundesland=Bayern&regierungsbezirk=Oberpfalz&filetype=csv",
203+
"height": 400
204+
},
205+
{
206+
"id": "3aGyL",
207+
"title": "Neue Corona-Fälle in Oberpfalz",
208+
"description": "Bestätigte Corona-Neuinfektionen nach Meldedatum mit 7-Tage Mittel",
209+
"csvUrl": "https://corona-api.interaktiv.br.de/query/infektionen-rb?filter=regierungsbezirk==Oberpfalz&sort=meldedatum&fieldList=meldedatum,anzahlFall,mittlere7TageInfektionen",
210+
"height": 400
211+
},
212+
{
213+
"id": "MKXT0",
214+
"title": "Corona-Fälle in Schwaben",
215+
"description": "Entwicklung der gemeldeten Fälle pro Tag",
216+
"csvUrl": "https://corona-deutschland-api.interaktiv.br.de/query?startDate=2020-02-25&dateField=Refdatum&group=Regierungsbezirk&bundesland=Bayern&regierungsbezirk=Schwaben&filetype=csv",
217+
"height": 400
218+
},
219+
{
220+
"id": "QTX31",
221+
"title": "Neue Corona-Fälle in Schwaben",
222+
"description": "Bestätigte Corona-Neuinfektionen nach Meldedatum mit 7-Tage Mittel",
223+
"csvUrl": "https://corona-api.interaktiv.br.de/query/infektionen-rb?filter=regierungsbezirk==Schwaben&sort=meldedatum&fieldList=meldedatum,anzahlFall,mittlere7TageInfektionen",
224+
"height": 400
225+
}
226+
]

‎charts.template.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[
2+
{
3+
"id": "QW2ItS",
4+
"title": "Line chart",
5+
"description": "Look at my beautiful data",
6+
"csvUrl": "https://example.com/my-csv-file-1.csv"
7+
},
8+
{
9+
"id": "RMP7TA",
10+
"title": "Bar chart",
11+
"description": "My favourite bar is a bar chart",
12+
"csvUrl": "https://example.com/my-csv-file-2.csv",
13+
"height": 400
14+
},
15+
{
16+
"id": "A2pSTY",
17+
"title": "Pie chart",
18+
"description": "Nobody should make pie charts",
19+
"csvUrl": "https://example.com/my-csv-file-3.csv",
20+
"height": 400,
21+
"width": 400
22+
}
23+
]

‎config.template.json

-27
This file was deleted.

‎index.js

+23-17
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
const fetch = require('node-fetch');
1+
const fetch = require("node-fetch");
2+
const charts = require("./charts.json");
3+
const apiKey = process.env.DATAWRAPPER_API_KEY;
24

3-
const { apiKey, charts } = require('./config.json');
5+
(async function init() {
6+
if (!apiKey) {
7+
console.error("Error: DATAWRAPPER_API_KEY is missing.");
8+
} else if (!charts) {
9+
console.error("Error: Chart configuration is missing or corrupted.");
10+
} else {
11+
await updateChart();
12+
}
13+
})();
414

5-
exports.datawrapperUpdater = async function (req, res) {
15+
async function updateChart() {
616
for (const chart of charts) {
717
const { id, description, csvUrl } = chart;
818

@@ -28,7 +38,7 @@ exports.datawrapperUpdater = async function (req, res) {
2838
if (description) {
2939
const updateMetaStatus = await updateMeta(id, description, dateString);
3040

31-
if (updateMetaStatus.error || updateMetaStatus.status === 'error') {
41+
if (updateMetaStatus.error || updateMetaStatus.status === "error") {
3242
console.error(
3343
`Error updating meta data for chart ${id}:`,
3444
JSON.stringify(updateMetaStatus)
@@ -37,23 +47,19 @@ exports.datawrapperUpdater = async function (req, res) {
3747
}
3848

3949
const publishStatus = await publishChart(id);
40-
if (publishStatus.error || publishStatus.status === 'error') {
50+
if (publishStatus.error || publishStatus.status === "error") {
4151
console.error(
4252
`Error publishing chart ${id}:`,
4353
JSON.stringify(publishStatus)
4454
);
4555
}
4656
}
4757
}
48-
49-
if (res && res.send) {
50-
res.send();
51-
}
52-
};
58+
}
5359

5460
async function getCsv(id, csvUrl) {
5561
return fetch(csvUrl, {
56-
method: 'GET',
62+
method: "GET",
5763
})
5864
.then((res) => res.text())
5965
.catch(() => ({
@@ -63,21 +69,21 @@ async function getCsv(id, csvUrl) {
6369

6470
async function updateData(id, csv) {
6571
return fetch(`https://api.datawrapper.de/v3/charts/${id}/data`, {
66-
method: 'PUT',
72+
method: "PUT",
6773
headers: {
6874
Authorization: `Bearer ${apiKey}`,
69-
'Content-Type': 'text/csv',
75+
"Content-Type": "text/csv",
7076
},
7177
body: csv,
7278
}).then((res) => res.text());
7379
}
7480

7581
async function updateMeta(id, description, dateString) {
7682
return fetch(`https://api.datawrapper.de/v3/charts/${id}`, {
77-
method: 'PATCH',
83+
method: "PATCH",
7884
headers: {
7985
Authorization: `Bearer ${apiKey}`,
80-
'Content-Type': 'application/json',
86+
"Content-Type": "application/json",
8187
},
8288
body: JSON.stringify({
8389
metadata: {
@@ -90,8 +96,8 @@ async function updateMeta(id, description, dateString) {
9096
}
9197

9298
async function publishChart(id) {
93-
return fetch(`https://api.datawrapper.de/charts/${id}/publish`, {
94-
method: 'POST',
99+
return fetch(`https://api.datawrapper.de/v3/charts/${id}/publish`, {
100+
method: "POST",
95101
headers: {
96102
Authorization: `Bearer ${apiKey}`,
97103
},

‎package-lock.json

+3,447-1,120
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
},
1212
"scripts": {
1313
"watch": "npm-watch start",
14-
"start": "functions-framework --target=datawrapperUpdater",
14+
"start": "node -r dotenv/config index.js",
1515
"test": "echo \"Error: no test specified\" && exit 1"
1616
},
1717
"watch": {
1818
"start": "*.js"
1919
},
2020
"dependencies": {
21-
"node-fetch": "^3.1.1"
21+
"dotenv": "^16.0.1",
22+
"node-fetch": "^2.6.7"
2223
},
2324
"devDependencies": {
2425
"@google-cloud/functions-framework": "^1.7.1",

0 commit comments

Comments
 (0)
Please sign in to comment.