https://drive.google.com/drive/folders/0B7qbRQX6_VNxd0NabjNpSXAzRHc?usp=sharing
- cmd ์ฐฝ์์ tomcat/bin/startup.bat ์คํ
- locathost:8082/kinggowarts ์ ์
- ์ ๋งํฌ์์ ์ต์ ์ ๋ฐฐํฌํ์ผ์ ๋ฐ๋๋ค. (kinggowartsXXXX_X.zip)
- ์์ถ์ ํ๋ฉด kinggowarts.war๊ฐ ๋์จ๋ค.
- tomcat/webapps ์์ kinggowarts ํด๋์ kinggowarts.war๋ฅผ ์ง์ด๋ค.
- ์๋ก์ด kinggowarts.war๋ฅผ tomcat/webapps ์ ๋ฃ์ด์ค๋ค.
- ํฐ์บฃ ์คํ
๋ก์ปฌ ํฐ์บฃ์๋ ๋ก์ปฌ XWiki ๋ํ ํฌํจ๋์ด์๋ค. ์ด๋ ์ด์(fanatic1.~)์ XWiki์ ๋์ผํ DB์ด์ง๋ง ๋ก์ปฌ์๋ฒ์์ ๋์๊ฐ๋ค.
๋ก์ปฌ์ฃผ์/xwiki ๋ก ๋ค์ด๊ฐ๋ฉด ๋ก์ปฌ์ XWiki๊ฐ ์ด๊ธฐํ๋๋ค. ์๋ฒ ์ฌ์์์ ํ ๋ ํ๋ฒ ๋ค์ด๊ฐ์ XWiki๋ฅผ ์ด๊ธฐํ ํด์ค์ผ ํ๋ค.
์ด๋ฅผ ํตํด ๋ก์ปฌ์๋ฒ์์๋ XWiki ๋ก๊ทธ์ธ์ ๋ฐ ์ ์์ด ๊ฐ๋ฅํ๋ค.(๋ก์ปฌ XWiki๋ฅผ ์ด์ฉํ์ง ์์ผ๋ฉด CORS๋ฌธ์ ๊ฐ ์๊ธด๋ค.)
- ํฌํธ๋ฒํธ ๋ณ๊ฒฝ์ tomcat/conf/server.xml ์ 8082 ๋ผ ๋์ด์๋ ๋ถ๋ถ์ ๋ฐ๊พธ๋ฉด ๋จ
- ์บ์ฑ ์ต์ ์ ๋๊ธฐ ์ํด์๋ tomcat/conf/context.xml ํ์ผ์ context ํ๊ทธ๋ฅผ ๋ค์๊ณผ ๊ฐ์ด ์์ ํด์ค๋ค.(static ํ์ผ๋ง ํด๋น)
<Context cacheMaxSize="0" cacheTTL="0" cachingAllowed="false"/>
- ์์ ๋ฐฐํฌํ์ผ์ ๊ฒฝ์ฐ ํฐ์บฃ์ ์คํํ ํ ์์ฑ๋๋ tomcat/webapps/kinggowarts/WEB-INF/classes/static์ผ๋ก, github ๊ฒฝ๋ก๋ Kinggowarts/src/main/resources/static๋ก ๊ฐ๋ค.
- npm install์ ์ ๋ ฅํ์ฌ gulp api๋ค์ ๋ฐ๋๋ค.
- static/src๊ฒฝ๋ก๋ก ์ด๋, gulp install์ ์ ๋ ฅํ์ฌ bower_components๋ก ํ์ํ ํ๋ก ํธ์๋ api๋ฅผ ๋ฐ๋๋ค.
- gulpfile.js๊ฐ ์๋ static ๊ฒฝ๋ก๋ก ๋ค์ ์ด๋ํ์ฌ gulp watch๋ฅผ ์ ๋ ฅํ๋ค. (js๋ css๊ฐ ๋ณํ๋ ๊ฒฝ์ฐ ์๋์ผ๋ก injectํ๋ค.)
npm install --save๋ก ์ค์น๋๋ api๋ค์ ๋ชจ๋ nodejs ๋ชจ๋์ด๊ธฐ ๋๋ฌธ์ ์ฐ๋ฆฌ๋ gulp๋ฅผ ์คํํ ๋๋ง ์ฌ์ฉํ๋ค.
๋ฐ๋ผ์ bower install --save๋ฅผ ์ด์ฉํ์ฌ bower ๋ชจ๋๋ก์จ ์ค์นํด์ผ ํ๋ค.
์ด ๋, --save๋ฅผ ์
๋ ฅํ๋ฉด ์ค์นํ ๋ชจ๋์ด ์๋์ผ๋ก ์ต์ ๋ฒ์ ผ ๊ธฐ์ค์ผ๋ก bower.json์ ๊ธฐ๋ก๋์ด ๋ค๋ฅธ ์ฌ๋๋ค์ bower install๋ง ์
๋ ฅํ๋ฉด ๋๋ค.
๋ฌผ๋ก ์ด ๋ bower.json์ด ์๋ ๊ฒฝ๋ก์์ bower install --save๋ฅผ ์
๋ ฅํด์ผ ํ๋ค.
- ์ฃผ์: /api/auth/login
- HTTP Method: POST
- Description: ๋ก๊ทธ์ธ ์์ฒญ
- Request Type: form data
- Request Value
username: ์ ์ ์์ด๋(์ด๋ฉ์ผ)
password: ๋น๋ฐ๋ฒํธ
-
Response Types: JSON
-
Response Value:
{
"userId": "[email protected]",/*์ ์ ์์ด๋*/
"memberSeq": 51,/*์ ์ ๊ฐ์ธํค*/
"authorities": [
{
"authority": "ROLE_GUEST"
}
],/*๊ถํ์ ๋ณด(๊ต์๊ฐ ์์ผ๋ฉด ์๋ฏธ์์)*/
"token": "8c1a9901-4a07-4f1d-910c-d3244f3b9702",/*์ธ์ฆํ ํฐ*/
"nickname": "user1",/*์ ์ ๋๋ค์*/
"name": "์ ์ 1", /*์ ์ ์ค๋ช
*/
"profileImgPath": "e2080ded-09ef-4a46-925b-f2e7665522b3_1.jpg"/*ํ๋กํ์ฌ์ง ํ์ผ๋ช
*/
}
- Status codes
400: ์๋ชป๋ ์์ฒญ (์์ฒญ ํ์
์ด ์๋ชป๋์๋ค๊ฑฐ๋ ์์ฒญํ ํ๋ผ๋ฏธํฐ๊ฐ ์๋ค๊ฑฐ๋)
- Comment
x-auth-token ๊ฐ์ผ๋ก token ๊ฐ์ ๋ฃ์ด์ฃผ๋ฉด ์ธ์ฆ์ด ๋๋ค.
ex) req.setRequestHeader('x-auth-token', token/*ํ ํฐ๊ฐ*/);
ํ๋กํ ์ฌ์ง์ /profileimg/ํ์ผ๋ช
์ผ๋ก ์์ฒญํ๋ฉด ๋ณด๋ด์ค๋ค.
์์ผ๋ฉด ํฌ๊ธฐ๊ฐ 0์ธ ์คํธ๋ง์ด ์ด ( "" )
- REST ์์ฒญ์ ์๋
- XWiki๋ก basic authentication์ ํจ๊ฒ ์์ฒญ์ ๋ณด๋ด๋ฉด ์ฟ ํค๋ฅผ ๊ฐ์ ธ์์ XWiki ๋ก๊ทธ์ธ ์ํ๋ฅผ ์ ์งํ ์ ์์.
- XWiki์ ์์ด๋๋ก๋ ๋๋ค์์ ์ฐ๊ณ ํจ์ค์๋๋ ๋์ผ.
- ์์
var xhr = new XMLHttpRequest();
//์ด๋ฐ์์ผ๋ก ์ฃผ์๊ฐ ํ์ฌ ํธ์คํธ๋ฅผ ๋ฐ์ํ๋๋ก ํจ
xhr.open("GET", location.protocol+"//"+location.host+"/xwiki/bin/view/Main/", true);
xhr.withCredentials = true;
xhr.setRequestHeader("Authorization", 'Basic ' + btoa('์์ด๋:ํจ์ค์๋'));
xhr.send();
-
์ฃผ์: /api/member/signup
- HTTP Method: POST
- Description: ํ์๊ฐ์ ์์ฒญ
- Request Type: form data
- Request Value
userId: ์ด๋ฉ์ผ ์ฃผ์ passWd: ํจ์ค์๋ (6~16์) nickname: ๋๋ค์ (1~16์) name: ์ด๋ฆ (1~16์)
- Response Types: text
- Response Value
success: ์ฑ๊ณต์ ์ธ ์์ฒญ duplicateId: ์์ด๋ ๊ฒน์นจ duplicateNickName: ๋๋ค์ ๊ฒน์นจ
- Status codes
400: ์๋ชป๋ ์์ฒญ (์์ฒญ ํ์ ์ด ์๋ชป๋์๋ค๊ฑฐ๋ ์์ฒญํ ํ๋ผ๋ฏธํฐ๊ฐ ์๋ค๊ฑฐ๋)
- Comment
ํ์๊ฐ์ ์๋ฃํ์ ์ฌ์ฉ์ ์ด๋ฉ์ผ๋ก ํ์๊ฐ์ ์์ฒญ ์ด๋ฉ์ผ์ด ๊ฐ๋ค. ๊ฑฐ๊ธฐ์ ์๋ ๋งํฌ๋ฅผ ๋๋ฅด๋ฉด ํ์๊ฐ์ ์์ฒญ์ด ์๋ฃ๋๋ค. ํ์๊ฐ์ ์์ฒญ๋งํฌ๋ก ์ด๋ํ ๋ค ๋ก๊ทธ์ธ์ ์๋ํ๋ฉด(์ฒซ ๋ก๊ทธ์ธ) ์ด๋ Xwiki ํ์๊ฐ์ ์ด ์๋์ผ๋ก ์๋ฃ๋๋ค. ๋ฐ๋ผ์ Xwiki๋ก๊ทธ์ธ์ Kinggowarts ๋ก๊ทธ์ธ์ ๋ง์น ๋ค์ callback์ผ๋ก ํด์ผํจ.
-
์ฃผ์: /api/member/profileImg
- HTTP Method: POST
- Description: ํ๋กํ ์ฌ์ง ์์
- Request Type: form data
- Request Value
<!--๋๋ต ์ด๋ฐ์์ผ๋ก ๋ณด๋ ๋๋ค. ์ค์ ๋ก ํ ๋๋ ์ธ์ฆํ ํฐ๋ ๊ฐ์ด ๋ณด๋ด์ธ์--> <!--์์ฒญ ํ๋ผ๋ฏธํฐ๋ Multipartํ์ file ์ ๋๋ค. --> <form id="uploadForm" enctype="multipart/form-data"> <input type="file" id="file" name="file"> </form> <script> var form = new FormData(document.getElementById('uploadForm')); $.ajax({ type:"POST", url:"./api/member/profileImg", data: form, dataType:'text', processData: false, contentType: false, success:function(args){ console.log(args ) } }); </script>
- Response Types: text
- Response Value
success: ์ฑ๊ณต์ ์ธ ์์ฒญ ๊ทธ ์ด์ธ: ์๋ฌ๋ฉ์ธ์ง(wrongType: ์ด๋ฏธ์งํ์ผ์ด์๋, nullFile: ๋นํ์ผ ...)
-
์ฃผ์: /api/member/changePassword
- HTTP Method: POST
- Description: ๋น๋ฐ๋ฒํธ ์์
- Request Type: form data
- Request Value
newPassword: ์ ๋น๋ฐ๋ฒํธ lastPassword: ๊ณผ๊ฑฐ ๋น๋ฐ๋ฒํธ
- Response Types: text
- Response Value
success: ์ฑ๊ณต์ ์ธ ์์ฒญ ๊ทธ ์ด์ธ: ์๋ฌ ๋ฉ์ธ์ง
-
์ฃผ์: /api/map
-
HTTP Method: GET
- Description: ์ง๋ ๊ตฌ์ญ ๋ชฉ๋ก ์์ฒญ
- Response Types: JSON
- Response Value
[ { "id": 45, "name": "testregion", "center": { "id": 267, "lng": 126.9738347803545, "lat": 37.29410858054493 }, "path": [ { "id": 268, "lng": 126.9738347803545, "lat": 37.29419858054493 }, { "id": 269, "lng": 126.9737347803545, "lat": 37.29429858054493 }, ... ], "type": "user", "shape": "POLYGON", "detail": "this is customEvent", "tags": [ { "id": 45, "name": "test" }, ... ] }, ... ]
-
HTTP Method: POST
-
Description: ์ง๋ ๊ตฌ์ญ ์ถ๊ฐ ์์ฒญ
-
Request Type: application/json
-
Request Value
name: ๊ตฌ์ญ์ด๋ฆ center: { lat : , lng : } shape: ๊ตฌ์ญ ํํ path: [ { lat : , lng : }, { lat : , lng : } ... ] detail: ๊ตฌ์ญ ์์ธ ์ค๋ช tags: [ { name : }, { name : } ... ]
-
Response Types: text
-
Response Value
success: ์ฑ๊ณต์ ์ธ ์์ฒญ duplicatedName: ์ค๋ณต๋ ๊ตฌ์ญ ์ด๋ฆ notAllowed: ํ์ฉ๋์ง ์์ ์์ฒญ
-
-
-
์ฃผ์: /api/map/{id}
-
HTTP Method: PUT
- Description: ์ง๋ ๊ตฌ์ญ ์์ ์์ฒญ
- Request Type: application/json
- Request Value
name: ๊ตฌ์ญ์ด๋ฆ center: { lat : , lng : } shape: ๊ตฌ์ญ ํํ path: [ { lat : , lng : }, { lat : , lng : } ... ] detail: ๊ตฌ์ญ ์์ธ ์ค๋ช tags: [ { name : }, { name : } ... ]
- Response Types: text
- Response Value
success: ์ฑ๊ณต์ ์ธ ์์ฒญ notAllowed: ํ์ฉ๋์ง ์์ ์์ฒญ duplicatedName: ์ค๋ณต๋ ๊ตฌ์ญ ์ด๋ฆ noLocation: ๊ตฌ์ญ ์ ๋ณด ์์
-
HTTP Method: DELETE
-
Description: ์ง๋ ๊ตฌ์ญ ์ญ์ ์์ฒญ
-
Response Types: text
-
Response Value
success: ์ฑ๊ณต์ ์ธ ์์ฒญ notAllowed: ํ์ฉ๋์ง ์์ ์์ฒญ noLocation: ๊ตฌ์ญ ์ ๋ณด ์์
-
-
-
์ฃผ์: /api/event
- HTTP Method: GET
-
Description: ๋ชจ๋ ์ด๋ฒคํธ ๋ชฉ๋ก
- Response Types: JSON
- Response Value
[ { "id": 1, "l_id": 1, "title": "testregion", "about": "this is customEvent", "creator": { "memberSeq": 1, "userId": "[email protected]", "nickname": "haha", "type": "S", "confirm": 3, "lng": -1, "lat": -1 }, "tags": [ { "id": 40, "name": "testTag" } ], "fromDate": 1496709514000, "toDate": 1496191135000 }, ... ]
-
- HTTP Method: POST
-
Description: ์ด๋ฒคํธ ์ถ๊ฐ ์์ฒญ
-
Request Type: application/json
-
Request Value
l_id: ๊ตฌ์ญ ๊ณ ์ ๋ฒํธ title: ์ด๋ฒคํธ ํ์ดํ about: ์ด๋ฒคํธ ์์ธ ์ค๋ช creator: { memberSeq: ์ฌ์ฉ์ ๊ณ ์ ๋ฒํธ } tags: [ { name : }, { name : } ... ] fromDate: ์ด๋ฒคํธ ์์ ๋ ์ง(Timestamp) toDate: ์ด๋ฒคํธ ์ข ๋ฃ ๋ ์ง(Timestamp)
-
Response Types: text
-
Response Value
success: ์ฑ๊ณต์ ์ธ ์์ฒญ noMember: ์ฌ์ฉ์ ์ ๋ณด ์์
-
- HTTP Method: GET
-
์ฃผ์: /api/event/{id}
-
HTTP Method: PUT
-
Description: ์ด๋ฒคํธ ์์ ์์ฒญ
-
Request Type: application/json
-
Request Value
l_id: ๊ตฌ์ญ ๊ณ ์ ๋ฒํธ title: ์ด๋ฒคํธ ํ์ดํ about: ์ด๋ฒคํธ ์์ธ ์ค๋ช creator: { memberSeq: ์ฌ์ฉ์ ๊ณ ์ ๋ฒํธ } tags: [ { name : }, { name : } ... ] fromDate: ์ด๋ฒคํธ ์์ ๋ ์ง(Timestamp) toDate: ์ด๋ฒคํธ ์ข ๋ฃ ๋ ์ง(Timestamp)
-
Response Types: text
-
Response Value
success: ์ฑ๊ณต์ ์ธ ์์ฒญ noEvent: ์ด๋ฒคํธ ์ ๋ณด ์์ noMember: ์ฌ์ฉ์ ์ ๋ณด ์์
-
-
HTTP Method: DELETE
-
Description: ์ด๋ฒคํธ ์ญ์ ์์ฒญ
-
Response Types: text
-
Response Value
success: ์ฑ๊ณต์ ์ธ ์์ฒญ noEvent: ์ด๋ฒคํธ ์ ๋ณด ์์
-
-
-
์ฃผ์: /api/member/reqPeerFromMe
-
HTTP Method: GET
- Description: ๋ด๊ฐ Peer ์์ฒญ ๋ณด๋ธ ๋ชฉ๋ก์ ๊ฐ์ ธ์ด
- Request Value: ์์
- Response Types: JSON
- Request Value
[ { "memberSeq": 23, "nickname": "tuser1", "name": "jj", "profileImgPath": "" }, { "memberSeq": 24, "nickname": "tuser2", "name": "afd", "profileImgPath": "" }, { "memberSeq": 25, "nickname": "tuser3", "name": "asd", "profileImgPath": "" } ]
-
HTTP Method: POST
- Description: Peer ์์ฒญ์ ๋ณด๋
- Request Type: form data
- Request Value
toSeq: ๋ฐ๋ ์ฌ๋์ member seq
- Response Types: ์์
-
-
์ฃผ์: /api/member/reqPeerToMe
-
HTTP Method: GET
- Description: ๋ด๊ฐ Peer ์์ฒญ ๋ฐ์ ๋ชฉ๋ก์ ๊ฐ์ ธ์ด
- Request Value: ์์
- Response Types: JSON
- Request Value
[ { "memberSeq": 23, "nickname": "tuser1", "name": "jj", "profileImgPath": "" }, { "memberSeq": 24, "nickname": "tuser2", "name": "afd", "profileImgPath": "" }, { "memberSeq": 25, "nickname": "tuser3", "name": "asd", "profileImgPath": "" } ]
-
HTTP Method: POST
- Description: Peer ์์ฒญ์ ์๋ฝ or ๊ฑฐ์
- Request Type: form data
- Request Value
toSeq: ๋ฐ๋ ์ฌ๋์ member seq type: ("true", "false") ์๋ฝ: "true", ๊ฑฐ์ : "false"
- Response Types: ์์
-
-
์ฃผ์: /api/member/peer
-
HTTP Method: GET
- Description: Peer ๋ชฉ๋ก์ ๊ฐ์ ธ์ด(-1 ์ขํ๋ ์์น๊ฐ ์๋ค๋ ์๋ฏธ)
- Request Value: ์์
- Response Types: JSON
- Request Value
[ { "memberSeq": 26, "nickname": "tuser4", "name": "gge", "lng": -1, "lat": -1, "profileImgPath": "" } ]
-
HTTP Method: DELETE
- Description: Peer๋ฅผ ์ญ์
- Request Type: url ํ๋ผ๋ฏธํฐ
- Request Value
toSeq: ๋ฐ๋ ์ฌ๋์ member seq
- Response Types: ์์
-
-
์ฃผ์: /api/member/coordinate
- Description: ๋ด ์ขํ๋ฅผ ๊ฐฑ์ ํ๊ณ peer๋ค์ ์์น๋ฅผ ๋ถ๋ฌ์ด
- HTTP Method: PATCH
- Request Type: form data
- Request Value
{ "lng" : 123.23, /*์ขํ๊ฐ ... ์๋ ์ขํ๋ฅผ ๋ฃ์๋๋ -1*/ "lat" : 123.53 }
- Response Types: JSON
- Request Value
[ { "memberSeq": 26, "nickname": "user4", "lng": -1, // -1์ผ๋ ์๋ ์ขํ "lat": -1 }, { "memberSeq": 27, "nickname": "user5", "lng": -1, "lat": -1 } ]
-
์ฃผ์: /api/marker
-
HTTP Method: GET
- Description: ๋ชจ๋ ๋ง์ปค ๋ชฉ๋ก
- Request Type: text
- Request Value
q: ๊ฒ์ํ ๋ง์ปค์ ์นดํ ๊ณ ๋ฆฌ
- Response Types: JSON
- Response Value
[ { "id": 2, "center": { "id": 313, "lng": 999.123, "lat": 8888.13312 }, "name": "marker test", "markerCategory": { "id": 3, "name": "์นดํ" } }, ... ]
- Description: ๋ชจ๋ ๋ง์ปค ๋ชฉ๋ก
-
HTTP Method: POST
- Description: ๋ง์ปค ์ถ๊ฐ ์์ฒญ
- Request Type: application/json
- Request Value
{ "center": { "lng": 999.123, "lat": 8888.13312 }, "name": "marker test", "markerCategory": { "name": "์นดํ" } }
- Response Types: text
- Response Value
success: ์ฑ๊ณต์ ์ธ ์์ฒญ duplicatedName: ์ค๋ณต๋ ๋ง์ปค ์ด๋ฆ noCategory: ์นดํ ๊ณ ๋ฆฌ ์ ๋ณด ์์ notAllowed: ํ์ฉ๋์ง ์์ ์์ฒญ
-
-
์ฃผ์: /api/marker/{id}
-
HTTP Method: PUT
- Description: ๋ง์ปค ์์ ์์ฒญ
- Request Type: application/json
- Request Value
{ "center": { "lng": 999.123, "lat": 8888.13312 }, "name": "marker test", "markerCategory": { "name": "์นดํ" } }
- Response Types: text
- Response Value
success: ์ฑ๊ณต์ ์ธ ์์ฒญ noMarker: ๋ง์ปค ์ ๋ณด ์์ duplicatedName: ์ค๋ณต๋ ๋ง์ปค ์ด๋ฆ noCategory: ์นดํ ๊ณ ๋ฆฌ ์ ๋ณด ์์ notAllowed: ํ์ฉ๋์ง ์์ ์์ฒญ
-
HTTP Method: DELETE
-
Description: ๋ง์ปค ์ญ์ ์์ฒญ
-
Response Types: text
-
Response Value
success: ์ฑ๊ณต์ ์ธ ์์ฒญ noMarker: ๋ง์ปค ์ ๋ณด ์์
-
-