Skip to content

Commit

Permalink
Nginx側にもCORS部分が必要, (#39)
Browse files Browse the repository at this point in the history
* Nginx側にもCORS部分が必要,
個人的利用のため*

* cors調整、nginxとechoでいい感じにする必要があった

* latestにする
  • Loading branch information
lottotto authored Aug 9, 2021
1 parent 6476640 commit ba79479
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
depends_on:
- app
app:
image: danish9966/todo-app
image: danish9966/todo-app:latest
environment:
- POSTGRES_HOST=db
# - ELASTIC_APM_SERVER_URL=http://x.x.x.x:8200
Expand All @@ -27,4 +27,4 @@ services:
ports:
- 5432:5432
volumes:
- ./sql:/docker-entrypoint-initdb.d
- ./sql:/docker-entrypoint-initdb.d
1 change: 0 additions & 1 deletion docker/nginx/defalut.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ server {
location /api/ {
proxy_pass http://app:1323/;

add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods "POST, GET, OPTIONS";
add_header Access-Control-Allow-Headers "Origin, Authorization, Accept";
add_header Access-Control-Allow-Credentials true;
Expand Down
4 changes: 2 additions & 2 deletions docker/sql/1_data.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
\c sample
INSERT INTO task(user_id, type_id, title, detail, deadline) VALUES (1,1,'JUnitを学習','テストの仕方を学習する','2020-07-07 15:00:00',true);
INSERT INTO task(user_id, type_id, title, detail, deadline) VALUES (1,3,'サービスの自作','マイクロサービス を作ってみる','2020-09-13 17:00:0', false);
INSERT INTO task(user_id, type_id, title, detail, deadline, done) VALUES (1,1,'JUnitを学習','テストの仕方を学習する','2020-07-07 15:00:00',true);
INSERT INTO task(user_id, type_id, title, detail, deadline, done) VALUES (1,3,'サービスの自作','マイクロサービス を作ってみる','2020-09-13 17:00:0', false);
2 changes: 1 addition & 1 deletion model/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Task struct {

Detail string `json:"detail,omitempty"`

Deadline time.Time `json:"deadline"`
Deadline time.Time `json:"deadline,omitempty"`

Done bool `json:"done"`
}
2 changes: 1 addition & 1 deletion router/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ func getRouter() *echo.Echo {
e := echo.New()

//middleware
e.Use(middleware.CORS())
e.Use(middleware.Logger())
e.Use(middleware.Recover())
e.Use(middleware.CORS())
e.Use(apmecho.Middleware())

handler := api.Handler{DB: db.Init()}
Expand Down

0 comments on commit ba79479

Please sign in to comment.