woowacourse / javascript-subway Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
[5688](A co 67) ## π€¦π» μ΄μ λ΄μ©
POST /members HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: localhost:42745
Content-Length: 96
{
"email" : "[email protected]",
"password" : "OTHER_password",
"name" : "μ¬μ©μ"
}
HTTP/1.1 201 Created
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Location: /members/2
Date: Thu, 18 Mar 2021 18:30:48 GMT
Keep-Alive: timeout=60
Connection: keep-alive
μλ
νμΈμ! APIμ https μ μ©μ΄ νμν΄λ³΄μ¬μ μ΄μ μ¬λ¦½λλ€!
ꡬνν κ±Έ λ°°ν¬ν λ λ³΄ν΅ Github Pagesλ₯Ό μ¬μ©νλλ°, httpsλ‘ λ°°ν¬λ©λλ€.
μ΄ λλ¬Έμ, API μμ²μ 보λ΄λ©΄ Mixed Content λ¬Έμ λ‘ μλ΅μ λ°μ μ μλ μν©μ΄ μκΉλλ€.
(httpμμ httpsλ‘ μμ²μ 보λ΄λ κ²μ κ°λ₯νμ§λ§, httpsμμ httpλ‘ μμ²μ λ³΄λΌ μ μλ μνμ
λλ€.)
μλ
νμΈμ λΈλΌμ΄
λΆμ² μ£ΌμΌ κ³ μνμλλ€.
CORS μ΄μλ‘ λ€μ μ°Ύμλ΅μμ΅λλ€. μ£μ‘ν©λλ€
μ μμ‘°μ¬νμ΅λλ€
μμμ DELETE /stations/1
μμμ PUT /stations/1
λ Έμ μμ PUT /lines/1
λ Έμ μμ DELETE /lines/1
ꡬκ°μ κ±° DELETE /lines/1/sections?stationId=2
μ 5κ° apiμμ corsμλ¬κ° λ°μν©λλ€
λλ¨Έμ§ GET, POST APIμμλ corsμλ¬κ° λ°μνμ§ μλ κ²μ νμΈνμ΅λλ€.
-General
Request URL: https://www.boorownie.com/lines/1/sections?stationId=2
Request Method: OPTIONS
Status Code: 403
Remote Address: 3.35.213.149:443
Referrer Policy: strict-origin-when-cross-origin
- Response Headers
Connection: keep-alive
Date: Tue, 23 Mar 2021 06:34:05 GMT
Server: nginx/1.18.0 (Ubuntu)
Transfer-Encoding: chunked
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
- Request Header
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7,zh-CN;q=0.6,zh;q=0.5,th;q=0.4,ja;q=0.3,de;q=0.2,fr;q=0.1
Access-Control-Request-Headers: authorization,content-type
Access-Control-Request-Method: DELETE
Connection: keep-alive
Host: www.boorownie.com
Origin: http://localhost:9000
Referer: http://localhost:9000/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
-General
Request URL: https://www.boorownie.com/lines/1/sections?stationId=2
Request Method: OPTIONS
Status Code: 403
Remote Address: 3.35.213.149:443
Referrer Policy: strict-origin-when-cross-origin
- Response Headers
Connection: keep-alive
Date: Tue, 23 Mar 2021 06:37:12 GMT
Server: nginx/1.18.0 (Ubuntu)
Transfer-Encoding: chunked
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
- Response Header
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7,zh-CN;q=0.6,zh;q=0.5,th;q=0.4,ja;q=0.3,de;q=0.2,fr;q=0.1
Access-Control-Request-Headers: authorization,content-type
Access-Control-Request-Method: PUT
Connection: keep-alive
Host: www.boorownie.com
Origin: http://localhost:9000
Referer: http://localhost:9000/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
HTTP/1.1 204 No Content
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Date: Mon, 22 Mar 2021 11:06:46 GMT
Keep-Alive: timeout=60
Connection: keep-alive
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Date: Mon, 22 Mar 2021 11:06:47 GMT
Keep-Alive: timeout=60
Connection: keep-alive
μλ
νμΈμ, λΈλΌμ΄! μ μμ κ΄λ ¨ν΄μ μ€λ₯κ° μλ κ² κ°μ νμΈμ°¨ μ΄μ μ¬λ Έμ΅λλ€.
νμ¬ postman μμ νμΈ κ²°κ³Ό μλ² μλ¬κ° μλκΉ μ‘°μ¬μ€λ μΆμΈ‘ν΄λ³΄κ³ μλλ°.. νμΈ λΆνλλ¦¬κ² μ΅λλ€. π
{
"timestamp": "2021-03-22T15:14:31.033+00:00",
"status": 500,
"error": "Internal Server Error",
"message": "",
"path": "/stations/1"
}
HTTP/1.1 204 No Content
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Date: Mon, 22 Mar 2021 11:06:46 GMT
Keep-Alive: timeout=60
Connection: keep-alive
λ Έμ μ μμ΄ λ±λ‘λμ΄μμ λ, μμ μμ²μ λν μλ΅ μμ²μ΄ 500μΌλ‘ μ΅λλ€.
statusλ₯Ό λ λͺ μμ μΌλ‘ λ§λ€κΈ° μν΄ 4XX λλ‘ Bad request μ²λ¦¬ν΄μ£Όμ ¨μΌλ©΄ μ’κ² μ΅λλ€ !!
λ
Έμ λ΄μ μλ€μ κ΅¬κ° μμ μ ν΅ν΄ μμ±κ³Ό μμ κ° κ°λ₯νκ² λλ¬Έμ,
λ
Έμ μ 보 μμ μ, μκ³Ό ꡬκ°μ μ 보(upStationId, downStationId, distance, duration)λ ν¬ν¨λμ§ μμλ λλ€κ³ μκ°ν©λλ€.
PUT /lines/1 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ7XCJpZFwiOjEsXCJlbWFpbFwiOlwiZW1haWxAZW1haWwuY29tXCIsXCJwYXNzd29yZFwiOlwicGFzc3dvcmRcIixcIm5hbWVcIjpcIuyCrOyaqeyekFwiLFwicHJpbmNpcGFsXCI6XCJlbWFpbEBlbWFpbC5jb21cIixcImNyZWRlbnRpYWxzXCI6XCJwYXNzd29yZFwifSIsImlhdCI6MTYxNjgyODExNywiZXhwIjoxNjE2ODMxNzE3fQ.c-YLzCIE9wOotZxqqQC85yjo32yFsw88EBnzk7Pc9VU
Content-Type: application/json; charset=UTF-8
Host: localhost:45515
Content-Length: 55
{
"name" : "ꡬλΆλΉμ ",
"color" : "bg-old-600"
"upStationId" : 1,
"downStationId" : 2,
"distance" : 10,
"duration" : 10
}
PUT /lines/1 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ7XCJpZFwiOjEsXCJlbWFpbFwiOlwiZW1haWxAZW1haWwuY29tXCIsXCJwYXNzd29yZFwiOlwicGFzc3dvcmRcIixcIm5hbWVcIjpcIuyCrOyaqeyekFwiLFwicHJpbmNpcGFsXCI6XCJlbWFpbEBlbWFpbC5jb21cIixcImNyZWRlbnRpYWxzXCI6XCJwYXNzd29yZFwifSIsImlhdCI6MTYxNjgyODExNywiZXhwIjoxNjE2ODMxNzE3fQ.c-YLzCIE9wOotZxqqQC85yjo32yFsw88EBnzk7Pc9VU
Content-Type: application/json; charset=UTF-8
Host: localhost:45515
Content-Length: 55
{
"name" : "ꡬλΆλΉμ ",
"color" : "bg-old-600"
}
κ²½λ‘ μ‘°ν μ μμΈ μν© μλ¬ λ©μμ§ μ²λ¦¬νκΈ°
νμ¬ λ°μμ€λ λ
Έμ λ°°μ΄ λ΄λΆμ μλ sections
λ°°μ΄μ΄ μ λ ¬ λμ΄μμ§ μμ κ²μΌλ‘ μΆμ λ©λλ€.
μ΄ λΆλΆμ λν΄μ νμΈ νλ² λΆνλλ¦¬κ² μ΅λλ€ !
μ λ ¬λ sections
λ₯Ό λ°μ μ μκΈΈ ν¬λ§ν©λλ€ :)
POST /members HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: localhost:42745
Content-Length: 96
{
"email" : "[email protected]",
"password" : "OTHER_password",
"name" : "μ¬μ©μ"
}
HTTP/1.1 201 Created
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Location: /members/2
Date: Thu, 18 Mar 2021 18:30:48 GMT
Keep-Alive: timeout=60
Connection: keep-alive
κ΅¬κ° μΆκ° μ,
νμ΄μ§λ₯Ό λ€μ λ‘λν΄μ μλ²μμ get line/ ν΄μμ λλ κ°μ κ²°κ³Όκ° λ°νλ©λλ€.
μΆκ°λ ννμ’ μ κ΅¬κ° bb - ddκ° μλ²μλ΅ μ stections λ°°μ΄ μ²«λ²μ§Έμ μμΉν¨
μν μ’
μ μ μΆκ° μ΄ν, νν μ’
μ μμ μΆκ°νμ λ μ μμ μΌλ‘ ννμ’
μ μμ΄ μΆκ°λλ€
->μλ²μλ΅ body μ€ sectionsλ°°μ΄μ μμκ° λ³΄μ₯μ΄ λλ€
μλλ©΄ μλλκ² μλ μ€νμΈμ§ κΆκΈν©λλ€! μμλκ° μμλ₯Ό λ°λ‘μ‘κΈ° μν΄ stationsλ₯Ό μ΄μ©ν΄μΌνλ 건κ°μ?
Response
μκ³Ό μ μ¬μ΄μ κ±°λ¦¬λ³΄λ€ μ’μ 거리λ₯Ό μ
λ ₯ν΄ μ£ΌμΈμ.
Response
거리μ μκ°μ 1 μ΄μμΈ κ°μ΄μ΄μΌ ν©λλ€.
ꡬκ°μ μ‘°νν λ, κ΅¬κ° κ°μ κ±°λ¦¬κ° μλ΅μΌλ‘ μ€μ§ μμ΅λλ€.
κ΅¬κ° λ±λ‘ μμ²μ 보λ΄μΌμ§λ§ κ΅¬κ° λ±λ‘ κ°λ₯ μ¬λΆλ₯Ό μ μμμ΅λλ€.
λ κ΅¬κ° μ¬μ΄μ κ²½λ‘ μ‘°νλ₯Ό λ§€λ² ν΄μΌ κ΅¬κ° κ°μ 거리λ₯Ό μ μ μμ΅λλ€.
Request
GET /lines/1 HTTP / 1.1
Authorization : Bearer {Access Token}
Content-Type: application/json; charset=UTF-8
Response
HTTP/1.1 201 Created
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Location: /stations/1
Content-Type: application/json
Transfer-Encoding: chunked
Date: Mon, 22 Mar 2021 11:06:46 GMT
Keep-Alive: timeout=60
Connection: keep-alive
Content-Length: 138
{
"id" : 1,
"name" : "μ λΆλΉμ ",
"color" : "bg-red-600",
"stations" : [ {
"id" : 1,
"name" : "κ°λ¨μ",
"createdDate" : "2021-03-24T00:38:43.343381",
"modifiedDate" : "2021-03-24T00:38:43.343381"
},
{
"upStationId" : 1,
"downStationId" : 2,
"distance" : 10,
"duration" : 10
},
{
"id" : 2,
"name" : "κ΄κ΅μ",
"createdDate" : "2021-03-24T00:38:43.362289",
"modifiedDate" : "2021-03-24T00:38:43.362289"
} ],
"createdDate" : "2021-03-24T00:38:43.392073",
"modifiedDate" : "2021-03-24T00:38:43.392073"
}
POST /members HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: localhost:42745
Content-Length: 96
{
"email" : "[email protected]",
"password" : "OTHER_password",
"name" : "μ¬μ©μ"
}
HTTP/1.1 201 Created
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Location: /members/2
Date: Thu, 18 Mar 2021 18:30:48 GMT
Keep-Alive: timeout=60
Connection: keep-alive
μ§νμ² μ μμ κ΄λ ¨ν api κ° μλ κ² κ°μμ λ¬Έμ λ립λλ€ !
PUT /stations/1 HTTP / 1.1
Authorization : Bearer {Access Token}
Content-Type: application/json; charset=UTF-8
{
"name" : "μμ μ"
}
HTTP/1.1 201 Created
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Location: /stations/1
Content-Type: application/json
Transfer-Encoding: chunked
Date: Mon, 22 Mar 2021 11:06:46 GMT
Keep-Alive: timeout=60
Connection: keep-alive
Content-Length: 138
{
"id" : 1,
"name" : "μμ ",
"createdDate" : "2021-03-22T11:06:47.305347",
"modifiedDate" : "2021-03-22T11:06:47.305347"
}
κ΅¬κ° μμ μ΄λ²€νΈλ₯Ό νΈλ€λ§νκΈ° μν΄μλ κ° sectionμ key μν μ ν μ μλ 무μΈκ°κ° νμν κ² κ°μ΅λλ€.
νΉμ λΌμΈμ κ° κ΅¬κ°λ§λ€ μμ΄λκ° λΆμ¬λμμΌλ©΄ μ’κ² μ΅λλ€ !
μ§νμ² μ μμ±μ΄ μμ΄λ λ³λ‘ ꡬλΆλμ§ μμ΅λλ€.
μλ₯Ό λ€μ΄
[email protected] μμ κ°λ¨
μ μΆκ°νμ κ²½μ°
[email protected]μμλ κ°λ¨
μ΄ μΆκ°λμ§ μλ λ¬Έμ κ° μμ΅λλ€.
κ³μ λ΄μμλ§ μμ΄λ¦μ΄ μ€λ³΅λμ§ μλλ€λ©΄
λ€λ₯Έ κ³μ μμ μ΄λ―Έ μΆκ°ν μμ΄λ¦λ μΆκ°κ° κ°λ₯ν΄μΌ ν κ² κ°μ΅λλ€.
νμ κ°μ¬ν©λλ€! λΈλΌμ΄ γ γ π
λ
Έμ μ΄λ¦μ λ°κΎΈμ§ μκ³ , λ€λ₯Έ κ°λ€μ μμ ν΄μ api μμ² μ, μ΄λ―Έ μ‘΄μ¬νλ λ
Έμ μ΄λ¦μ
λλ€
λΌλ 400 μλ¬λ©μμ§ μλ΅.
무쑰건 λ Έμ μ΄λ¦μ μμ ν΄μΌνλλ― λ³΄μ λλ€
λ Έμ μ΄λ¦μ μμ νμ§ μκ³ λ μ¬ν κ° μμ κ°λ₯ν΄μΌν κ² κ°μ΅λλ€
λΈλΌμ΄ κ³ μ λ§μΌμλλ€..
λ€λ¦μλλΌ cors μ΄μκ° λ°μν΄μ μ΄μλμ κΈμ¬λ¦½λλ€
-General
Request URL: https://www.boorownie.com/stations
Request Method: OPTIONS
Status Code: 500
Remote Address: 3.35.213.149:443
Referrer Policy: strict-origin-when-cross-origin
-Response Header
Connection: keep-alive
Content-Language: en
Content-Length: 455
Content-Type: text/html;charset=utf-8
Date: Mon, 22 Mar 2021 10:48:36 GMT
Server: nginx/1.18.0 (Ubuntu)
-Request Header
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7,zh-CN;q=0.6,zh;q=0.5,th;q=0.4,ja;q=0.3,de;q=0.2,fr;q=0.1
Access-Control-Request-Headers: authorization,content-type
Access-Control-Request-Method: GET
Connection: keep-alive
Host: www.boorownie.com
Origin: http://localhost:9000
Referer: http://localhost:9000/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
stations:1 Access to fetch at 'https://www.boorownie.com/stations' from origin
'http://localhost:9000' has been blocked by CORS policy:
Response to preflight request doesn't pass access control check:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
If an opaque response serves your needs, set the request's mode
to 'no-cors' to fetch the resource with CORS disabled.
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 20 Mar 2021 01:03:46 GMT
Keep-Alive: timeout=60
Connection: keep-alive
Content-Length: 142
[ {
"id" : 1,
"name" : "μ§νμ² μ",
"createdDate" : "2021-03-20T01:03:47.185685",
"modifiedDate" : "2021-03-20T01:03:47.185685"
} ]
Request
http://3.35.213.149/paths?source=292&target=300&type=DISTANCE
Response
{
"timestamp": "2021-03-24T06:41:08.331+00:00",
"status": 500,
"error": "Internal Server Error",
"message": "",
"path": "/paths"
}
μ‘°νκ° λκΈ°λ₯Ό κΈ°λν©λλ€.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.