Refactor to move cloud fn to top level
This commit is contained in:
parent
28abf0e461
commit
3559ca9ec1
14 changed files with 14 additions and 13 deletions
|
@ -5,6 +5,7 @@ Match patterns and solve anagrams - handy for crossword fanatics.
|
|||
## Standalone Server
|
||||
|
||||
```bash
|
||||
cd standalone
|
||||
go run main.go
|
||||
```
|
||||
|
||||
|
@ -14,7 +15,7 @@ To test using the Cloud Functions Framework:
|
|||
|
||||
```bash
|
||||
env FUNCTION_TARGET=WordSearch WORDLIST_BUCKET=word-search-1729-assets \
|
||||
WORDLIST_PATH=data/wordlist.txt LOCAL_ONLY=true go run cmd/main.go
|
||||
WORDLIST_PATH=data/wordlist.txt LOCAL_ONLY=true go run ./cmd/fn-framework-test/main.go
|
||||
|
||||
curl 'http://localhost:8080?mode=anagrams&pattern=idea'
|
||||
```
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"io"
|
||||
"sort"
|
||||
|
||||
"github.com/ray1729/puzzle-solver/util"
|
||||
"github.com/ray1729/wordsearch/util"
|
||||
)
|
||||
|
||||
type DB interface {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package cloudfn
|
||||
package wordsearch
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
|
@ -12,8 +12,8 @@ import (
|
|||
|
||||
"cloud.google.com/go/storage"
|
||||
"github.com/GoogleCloudPlatform/functions-framework-go/functions"
|
||||
"github.com/ray1729/puzzle-solver/anagram"
|
||||
"github.com/ray1729/puzzle-solver/match"
|
||||
"github.com/ray1729/wordsearch/anagram"
|
||||
"github.com/ray1729/wordsearch/match"
|
||||
"github.com/rs/cors"
|
||||
)
|
||||
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
// Blank-import the function package so the init() runs
|
||||
"github.com/GoogleCloudPlatform/functions-framework-go/funcframework"
|
||||
_ "github.com/ray1729/puzzle-solver/cloudfn"
|
||||
_ "github.com/ray1729/wordsearch"
|
||||
)
|
||||
|
||||
func main() {
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
|||
module github.com/ray1729/puzzle-solver
|
||||
module github.com/ray1729/wordsearch
|
||||
|
||||
go 1.21.1
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"bufio"
|
||||
"io"
|
||||
|
||||
"github.com/ray1729/puzzle-solver/util"
|
||||
"github.com/ray1729/wordsearch/util"
|
||||
)
|
||||
|
||||
type DB interface {
|
||||
|
|
|
@ -6,9 +6,9 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/ray1729/puzzle-solver/anagram"
|
||||
"github.com/ray1729/puzzle-solver/match"
|
||||
"github.com/ray1729/puzzle-solver/server"
|
||||
"github.com/ray1729/wordsearch/anagram"
|
||||
"github.com/ray1729/wordsearch/match"
|
||||
"github.com/ray1729/wordsearch/standalone/server"
|
||||
)
|
||||
|
||||
var matchDB match.DB
|
|
@ -7,8 +7,8 @@ import (
|
|||
"net/http"
|
||||
"sort"
|
||||
|
||||
"github.com/ray1729/puzzle-solver/anagram"
|
||||
"github.com/ray1729/puzzle-solver/match"
|
||||
"github.com/ray1729/wordsearch/anagram"
|
||||
"github.com/ray1729/wordsearch/match"
|
||||
)
|
||||
|
||||
func New(assetsPath string, matchDB match.DB, anagramDB anagram.DB) http.Handler {
|
Loading…
Reference in a new issue