
Angular was added to organize the FE of the UI application better. In doing so I have rebuilt the build scripts, added a routing mechanism for the Go server to route and serve the compiled TS pages from Angular. Change-Id: I7ae2cacfd90372fa536b1639e5b54a8da786e2cd
46 lines
1.0 KiB
Go
46 lines
1.0 KiB
Go
/*
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
https://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package utilhttp
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
// Header stuct for a http header.
|
|
type Header struct {
|
|
Key string
|
|
Value string
|
|
}
|
|
|
|
// Oauth stuct for oauth parameters.
|
|
type Oauth struct {
|
|
ClientID string
|
|
ClientSecret string
|
|
}
|
|
|
|
// API struct for apis.
|
|
type API struct {
|
|
URL string
|
|
Headers []Header
|
|
Oauth Oauth
|
|
}
|
|
|
|
// HandleErr handles a http error.
|
|
func HandleErr(w http.ResponseWriter, err error, code int) {
|
|
fmt.Printf("[Error] %+v\n\n", err)
|
|
http.Error(w, err.Error(), code)
|
|
}
|