-
Notifications
You must be signed in to change notification settings - Fork 10
/
server.js
70 lines (62 loc) · 1.92 KB
/
server.js
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
const fs = require("fs");
const express = require("express");
const index = fs.readFileSync("index.html", "utf8");
const style = require("./index").generateStyle({
// Urls to replace
sourcesUrl: "http://localhost:8080/",
glyphsUrl: "",
spriteUrl: "",
queryParams: [
{
url: "https://dev-api.digitransit.fi/",
name: "digitransit-subscription-key",
value: "my-secret-key",
},
],
components: {
// Set each layer you want to include to true
// Styles
base: { enabled: true }, // Enabled by default
municipal_borders: { enabled: false },
routes: { enabled: false },
text: { enabled: true }, // Enabled by default
subway_entrance: { enabled: false },
poi: { enabled: false },
park_and_ride: { enabled: false },
ticket_sales: { enabled: false },
stops: { enabled: false },
citybikes: { enabled: false },
ticket_zones: { enabled: false },
ticket_zone_labels: { enabled: false },
// Themes
text_sv: { enabled: false },
text_fisv: { enabled: false },
text_en: { enabled: false },
regular_routes: { enabled: false },
near_bus_routes: { enabled: false },
routes_with_departures_only: { enabled: true }, // Enabled by default. Doesn't do anything until routes is enabled.
regular_stops: { enabled: false },
near_bus_stops: { enabled: false },
print: { enabled: false },
greyscale: { enabled: false },
simplified: { enabled: false },
"3d": { enabled: false },
},
// optional property to show only listed routes by jore id
routeFilter: [],
});
const app = express();
app.get("/", (req, res) => {
res.redirect("/index.html");
});
app.get("/index.html", (req, res) => {
res.set("Content-Type", "text/html");
res.send(index);
});
app.get("/style.json", (req, res) => {
res.set("Content-Type", "application/json");
res.send(style);
});
app.listen(3000, () => {
console.log("Listening at localhost:3000");
});