25 lines
482 B
Go
25 lines
482 B
Go
// Package implements "galaxy/connector.Connector" interface with HTTP REST API protocol
|
|
package http
|
|
|
|
import (
|
|
"context"
|
|
"net/url"
|
|
)
|
|
|
|
type httpConnector struct {
|
|
ctx context.Context
|
|
backendURL *url.URL // HTTP REST API Server URL
|
|
}
|
|
|
|
func NewHttpConnector(ctx context.Context, backendURL string) (*httpConnector, error) {
|
|
u, err := url.Parse(backendURL)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
h := &httpConnector{
|
|
ctx: ctx,
|
|
backendURL: u,
|
|
}
|
|
return h, nil
|
|
}
|