Skip to content

Commit

Permalink
change static server to nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
fifsky committed Mar 20, 2020
1 parent f24a705 commit f047645
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func main() {
w.Write(st)
})

http.Handle("/api/struct/gen", c.Handler(handler))
http.Handle("/genapi/struct/gen", c.Handler(handler))

err = http.ListenAndServe(":8989",nil)

Expand Down
6 changes: 3 additions & 3 deletions web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM abiosoft/caddy:latest
COPY ./Caddyfile /etc/Caddyfile
COPY ./dist/ /usr/share/caddy/
FROM nginx:alpine
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
COPY ./dist/ /usr/share/nginx/html/
9 changes: 9 additions & 0 deletions web/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
server {
listen 80;
index index.html index.htm;
root /usr/share/nginx/html/;

location / {
try_files $uri $uri/ /index.html;
}
}
2 changes: 1 addition & 1 deletion web/src/service/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import {createApi} from "../util";

export const genApi = data => createApi("/api/struct/gen", data);
export const genApi = data => createApi("/genapi/struct/gen", data);

0 comments on commit f047645

Please sign in to comment.