Skip to content

Commit

Permalink
snapshot - update deps; use aaronland/go-http-server
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisaaronland committed Dec 7, 2020
1 parent cf72653 commit 0a4a674
Show file tree
Hide file tree
Showing 18 changed files with 762 additions and 135 deletions.
22 changes: 8 additions & 14 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ package main
import (
"context"
"fmt"
"github.com/aaronland/go-http-server"
"github.com/aaronland/go-http-bootstrap"
"github.com/aaronland/go-http-tangramjs"
"github.com/rs/cors"
"github.com/whosonfirst/go-whosonfirst-spatial-http/api"
"github.com/whosonfirst/go-whosonfirst-spatial-http/assets/templates"
"github.com/whosonfirst/go-whosonfirst-spatial-http/health"
"github.com/whosonfirst/go-whosonfirst-spatial-http/server"
"github.com/whosonfirst/go-whosonfirst-spatial-http/www"
"github.com/whosonfirst/go-whosonfirst-spatial/app"
_ "github.com/whosonfirst/go-whosonfirst-spatial/database/rtree"
Expand All @@ -20,7 +20,6 @@ import (
"html/template"
"log"
gohttp "net/http"
gourl "net/url"
)

func main() {
Expand Down Expand Up @@ -65,10 +64,13 @@ func main() {

data_endpoint, _ := flags.StringVar(fs, "data-endpoint")

// REPLACE ALL OF THIS WITH PLAIN VANILLA -server-uri FLAG

host, _ := flags.StringVar(fs, "host")
port, _ := flags.IntVar(fs, "port")
proto := "http" // FIX ME

server_uri := fmt.Sprintf("http://%s:%d", host, port)

spatial_app, err := app.NewSpatialApplicationWithFlagSet(ctx, fs)

if err != nil {
Expand Down Expand Up @@ -217,23 +219,15 @@ func main() {
mux.Handle("/point-in-polygon", www_pip_handler)
}

address := fmt.Sprintf("spatial://%s:%d", host, port)

u, err := gourl.Parse(address)

if err != nil {
logger.Fatal("Failed to parse address '%s', %v", address, err)
}

s, err := server.NewStaticServer(proto, u)
s, err := server.NewServer(ctx, server_uri)

if err != nil {
logger.Fatal("Failed to create new server for '%s' (%s), %v", u, proto, err)
logger.Fatal("Failed to create new server for '%s', %v", server_uri, err)
}

logger.Info("Listening on %s", s.Address())

err = s.ListenAndServe(mux)
err = s.ListenAndServe(ctx, mux)

if err != nil {
logger.Fatal("Failed to start server, %v", err)
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ require (
github.com/aaronland/go-http-bootstrap v0.0.6
github.com/aaronland/go-http-rewrite v0.0.6
github.com/aaronland/go-http-sanitize v0.0.4
github.com/aaronland/go-http-server v0.0.5
github.com/aaronland/go-http-tangramjs v0.0.7
github.com/rs/cors v1.7.0
github.com/skelterjohn/geom v0.0.0-20180103142417-96f3e8a219c5
github.com/whosonfirst/algnhsa v0.1.0
github.com/whosonfirst/algnhsa v0.1.0 // indirect
github.com/whosonfirst/go-bindata v0.1.0
github.com/whosonfirst/go-bindata-assetfs v1.0.1
github.com/whosonfirst/go-whosonfirst-geojson-v2 v0.12.3
github.com/whosonfirst/go-whosonfirst-index v0.3.2
github.com/whosonfirst/go-whosonfirst-placetypes v0.2.4
github.com/whosonfirst/go-whosonfirst-spatial v0.0.3
github.com/whosonfirst/go-whosonfirst-spatial v0.0.4
github.com/whosonfirst/go-whosonfirst-spr v0.1.0
)
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ github.com/aaronland/go-http-rewrite v0.0.6 h1:IGmNgC+VIkOPw9h9kdhqZT48oaUbeaRgG
github.com/aaronland/go-http-rewrite v0.0.6/go.mod h1:+Ehclg6SIiQPEJlSv3LR+8rojSSYPLGQuDf2z9bChpY=
github.com/aaronland/go-http-sanitize v0.0.4 h1:oAYe5DbtbDS6x5Rygv5II6fDHzATGIAyY4/ZDZ63G2w=
github.com/aaronland/go-http-sanitize v0.0.4/go.mod h1:qUi4rzUPcpMntpUFnHK00yQI5vd/Q7x9MFYwX91/ygI=
github.com/aaronland/go-http-server v0.0.5 h1:DxQKt2tcoq27gjqMJ9/wKyTu0briY9lPuKwBTXXh90o=
github.com/aaronland/go-http-server v0.0.5/go.mod h1:6dtsZDrQG0XvUOCL0eaHsUw+7gw3Xa/Nm+XofvkSw2w=
github.com/aaronland/go-http-tangramjs v0.0.6 h1:Ke2hU/flaO6hmK4AxH6ubKIEtqKItowqaWe4IA/3aFU=
github.com/aaronland/go-http-tangramjs v0.0.6/go.mod h1:9gLqN7c67fdkshqG5wiSWFZkIJdtbC2uA5kdGGrhLyw=
github.com/aaronland/go-http-tangramjs v0.0.7 h1:tMPgSvlXp50wng7PcceqAzHEYkD8BKQrkKnygaLCmUs=
Expand Down Expand Up @@ -94,6 +96,7 @@ github.com/tidwall/gjson v1.6.3 h1:aHoiiem0dr7GHkW001T1SMTJ7X5PvyekH5WX0whWGnI=
github.com/tidwall/gjson v1.6.3/go.mod h1:BaHyNc5bjzYkPqgLq7mdVzeiRtULKULXLgZFKsxEHI0=
github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc=
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/pretty v1.0.1 h1:WE4RBSZ1x6McVVC8S/Md+Qse8YUv6HRObAx6ke00NY8=
github.com/tidwall/pretty v1.0.1/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
Expand Down Expand Up @@ -172,6 +175,8 @@ github.com/whosonfirst/go-whosonfirst-spatial v0.0.2 h1:X3hoOIh4CqHd20Lujfj3bwZZ
github.com/whosonfirst/go-whosonfirst-spatial v0.0.2/go.mod h1:lVjcZgLF4JM3HpocC3nHofyX0ojtacPj7oJsUlP36pA=
github.com/whosonfirst/go-whosonfirst-spatial v0.0.3 h1:cJ3xCEurT/nyIKt34X79GfnRpkDRN8JTiz6v6V6/Dac=
github.com/whosonfirst/go-whosonfirst-spatial v0.0.3/go.mod h1:lVjcZgLF4JM3HpocC3nHofyX0ojtacPj7oJsUlP36pA=
github.com/whosonfirst/go-whosonfirst-spatial v0.0.4 h1:3CbSlmVjq4XB9TEjGSL39+eAMc3IvmgF0j0pB+AMVvY=
github.com/whosonfirst/go-whosonfirst-spatial v0.0.4/go.mod h1:lVjcZgLF4JM3HpocC3nHofyX0ojtacPj7oJsUlP36pA=
github.com/whosonfirst/go-whosonfirst-spr v0.1.0 h1:5qE629nCiucF2upy5NjPOEl9cFatsljykYY0l2JKgAk=
github.com/whosonfirst/go-whosonfirst-spr v0.1.0/go.mod h1:R8GtEVz1GVSnwwOjzcoVUd172ZK26Q7hQSLI6SGG7lM=
github.com/whosonfirst/go-whosonfirst-sqlite v0.0.2/go.mod h1:JmSK+NaXOzmZJXkzOdy2mHwMJvAbUzKw//B3dVr98H0=
Expand Down
31 changes: 0 additions & 31 deletions server/http.go

This file was deleted.

38 changes: 0 additions & 38 deletions server/lambda.go

This file was deleted.

40 changes: 0 additions & 40 deletions server/server.go

This file was deleted.

2 changes: 2 additions & 0 deletions vendor/github.com/aaronland/go-http-server/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

132 changes: 132 additions & 0 deletions vendor/github.com/aaronland/go-http-server/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions vendor/github.com/aaronland/go-http-server/go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions vendor/github.com/aaronland/go-http-server/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0a4a674

Please sign in to comment.