dynamic url for localhost + ingress functionality

This commit is contained in:
marcel-dempers 2020-09-27 11:25:40 +10:00 committed by Marcel Dempers
parent 0ad5d30834
commit 6012dbaaf8

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1" /> <meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="./bootstrap.min.css"> <link rel="stylesheet" href="bootstrap.min.css">
<title>Video Catalog</title> <title>Video Catalog</title>
</head> </head>
@ -68,10 +68,17 @@
playlist: [], playlist: [],
}; };
var playlistApiUrl = "";
if (location.hostname == "localhost"){
playlistApiUrl = "http://localhost:81/"
} else {
playlistApiUrl = "http://" + location.hostname + "/api/playlists"
}
var app = angular.module('videos', []); var app = angular.module('videos', []);
app.controller('videosController', function ($scope, $http) { app.controller('videosController', function ($scope, $http) {
$http.get("http://localhost:81/") $http.get(playlistApiUrl)
.then(function (response) { .then(function (response) {
console.log(response); console.log(response);