first commit

This commit is contained in:
2020-08-14 10:21:12 +08:00
parent 5c00a2534b
commit 4ac29d32e0
8 changed files with 41 additions and 2 deletions
Generated
+1
View File
@@ -2,5 +2,6 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/playfront" vcs="Git" />
</component>
</project>
+19
View File
@@ -0,0 +1,19 @@
FROM node:8
COPY playfront /app
WORKDIR /app
#RUN npm install -g webpack typescript
#RUN npm install
RUN npx webpack
#RUN webpack
FROM nginx:1.11-alpine
COPY --from=0 /app/index.html /usr/share/nginx/html/
COPY --from=0 /app/dist /usr/share/nginx/html/dist/
COPY --from=0 /app/node_modules/bootstrap/dist/css/bootstrap.min.css /usr/share/nginx/html/node_modules/bootstrap/dist/css/bootstrap.min.css
COPY --from=0 /app/node_modules/react/umd/react.production.min.js /usr/share/nginx/html/node_modules/react/umd/react.production.min.js
COPY --from=0 /app/node_modules/react-dom/umd/react-dom.production.min.js /usr/share/nginx/html/node_modules/react-dom/umd/react-dom.production.min.js
COPY --from=0 /app/node_modules/whatwg-fetch/fetch.js /usr/share/nginx/html/node_modules/whatwg-fetch/fetch.js
+1
View File
@@ -10,6 +10,7 @@ ENV GOPATH=/go
RUN go get "github.com/gorilla/mux"
RUN go get "gopkg.in/mgo.v2"
RUN go get "github.com/gorilla/handlers"
RUN CGO_ENABLED=0 GOOS=linux go build -o /nbaservice ./nbaservice
+13 -1
View File
@@ -1,7 +1,8 @@
version: "3"
services:
test:
playerser:
container_name: "playerser"
build:
context: ..
dockerfile: ./nbarest/Dockerfile.service
@@ -11,6 +12,17 @@ services:
- mongodb
mongodb:
container_name: "mongodb"
image: mongo
ports:
- "27017:27017"
front:
container_name: "front"
build:
context: .
dockerfile: ./Dockerfile
ports:
- "80:80"
links:
- playerser
+1
View File
@@ -3,6 +3,7 @@ module nbarest
go 1.14
require (
github.com/gorilla/handlers v1.4.2
github.com/gorilla/mux v1.7.4
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
)
+2
View File
@@ -1,3 +1,5 @@
github.com/gorilla/handlers v1.4.2 h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YARg=
github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc=
github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=
+3 -1
View File
@@ -2,6 +2,7 @@ package rest
import (
"fmt"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"nbarest/lib/persistence"
"net/http"
@@ -16,6 +17,7 @@ func ServeAPI(endpoint string,dbhandler persistence.DatabaseHandler) error{
playersrouter.Path("/").HandlerFunc(handler.FindAllPlayerHandler).Methods("GET")
playersrouter.Path("/").HandlerFunc(handler.NewPlayerHandler).Methods("POST")
fmt.Println("listen")
return http.ListenAndServe(endpoint,r)
server := handlers.CORS()(r)
return http.ListenAndServe(endpoint, server)
}
Submodule
+1
Submodule playfront added at 717abfab12