Skip to content

Commit 107a4c5

Browse files
committed
changed port number
1 parent 09e2083 commit 107a4c5

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Repository for 'Fachpraktikum Algorithms on OpenStreetMap data' at University St
44
# Instructions
55
### Install Golang
66
At first, you have to install golang on your System.<br>
7-
Version 1.18 is recommend.<br>
7+
Version 1.18 is recommended.<br>
88
For ubuntu you can follow [this](https://cmatskas.com/install-go-on-wsl-ubuntu-from-the-command-line/) blog post.
99
### Generate FMI file from PBF file
1010
1. Navigate into the project folder, so that you are in the directory OSM.
@@ -15,11 +15,11 @@ For ubuntu you can follow [this](https://cmatskas.com/install-go-on-wsl-ubuntu-f
1515
### Run Webserver
1616
1. Navigate into the project folder, so that you are in the directory OSM.
1717
2. Build the project with command: go build ./src/mainWeb.go
18-
3. Ron project with command: ./mainWeb {pathToFmiFile} {port}
19-
4. The GUI can be found at localhost/{port}
18+
3. Ron project with command: ./mainWeb {pathToFmiFile}
19+
4. The GUI can be found at localhost/8081
2020

2121
### How to use GUI
22-
- In your browser navigate to localhost/{port}
22+
- In your browser navigate to localhost/8081
2323
- To set a starting point just click anywhere on the map
2424
- To create a ending point click anywhere on the map
2525
- Both points will snap to the closest point in water that was created in Task 3

src/mainWeb.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ import (
77

88
func main() {
99
pathToFmi := os.Args[1]
10-
port := os.Args[2]
11-
web.Main(pathToFmi, port)
10+
web.Main(pathToFmi)
1211
}

src/web/server.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,22 @@ import (
44
"OSM/src/backend/datastructures"
55
helpers2 "OSM/src/backend/helpers"
66
"OSM/src/backend/shortestPath"
7-
"fmt"
87
"log"
98
"math"
109
"net/http"
1110
"strconv"
1211
)
1312

14-
func Main(pathToFmiFile string, port string) {
13+
func Main(pathToFmiFile string) {
1514
graph := helpers2.CreateGraphFromFile(pathToFmiFile)
1615

1716
fileServer := http.FileServer(http.Dir("./src/web/static"))
1817
http.Handle("/", fileServer)
1918
http.HandleFunc("/route", routeHandler(graph))
2019
http.HandleFunc("/point", pointHandler(graph))
2120

22-
log.Printf("Starting server at port %s\n", port)
23-
if err := http.ListenAndServe(fmt.Sprintf(":%s", port), nil); err != nil {
21+
log.Printf("Starting server at port 8081\n")
22+
if err := http.ListenAndServe(":8081", nil); err != nil {
2423
log.Fatal(err)
2524
}
2625
}

src/web/static/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<body>
1616
<div id="map"></div>
17-
<script src="main.js"></script>
17+
<script src="./main.js"></script>
1818

1919
</body>
2020
</html>

src/web/static/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function fetchPoint(point, isStart) {
102102
lat: point.getLatLng().lat, lng: point.getLatLng().lng
103103
};
104104
//build URL
105-
let url = new URL("http://localhost:8080/point");
105+
let url = new URL("http://localhost:8081/point");
106106
for (let k in data) {
107107
url.searchParams.append(k, data[k]);
108108
}
@@ -147,7 +147,7 @@ function fetchRoute() {
147147
};
148148

149149
// build URL
150-
let url = new URL("http://localhost:8080/route");
150+
let url = new URL("http://localhost:8081/route");
151151
for (let k in data) {
152152
url.searchParams.append(k, data[k]);
153153
}

0 commit comments

Comments
 (0)