本文同步發表於: Sponge Records
目前我們的 api 已開發完成,來整理一下 api 的 url、他們的傳入傳出的參數與功能吧
/api/user/create
建立會員帳號,檢核帳號是否為合法信箱與密碼是否滿 6 位數字
輸入參數
{
"email":"demo@test.com",
"password":"demo"
}
回傳
{
"account": {
"ID": 8,
"CreatedAt": "2019-10-06T09:52:00.872431Z",
"UpdatedAt": "2019-10-06T09:52:00.872431Z",
"DeletedAt": null,
"email": "test1234@gmail.com",
"password": "",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2Vy9.lrlKLD-upq7YjH7jN_ihPPmLRymsIVnND9DW1ob8ZUk"
},
"message": "account has been create",
"status": true
}
/api/user/login
會員帳號登入,驗證帳號是否存在
輸入參數
{
"email":"demo@test.com",
"password":"demo"
}
回傳
{
"account": {
"ID": 8,
"CreatedAt": "2019-10-06T09:52:00.872431Z",
"UpdatedAt": "2019-10-06T09:52:00.872431Z",
"DeletedAt": null,
"email": "test1234@gmail.com",
"password": "",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2Vy9.lrlKLD-upq7YjH7jN_ihPPmLRymsIVnND9DW1ob8ZUk"
},
"message": "Logged In",
"status": true
}
/api/user/editor
會員帳號修改,檢核舊密碼是否正確與新帳號是否滿 6 位數字
輸入參數
{
"email":"demo@test.com",
"oldpassword":"demo",
"password":"demo1"
}
回傳
{
"account": {
"ID": 8,
"CreatedAt": "2019-10-06T09:52:00.872431Z",
"UpdatedAt": "2019-10-06T09:52:00.872431Z",
"DeletedAt": null,
"email": "test1234@gmail.com",
"password": "",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2Vy9.lrlKLD-upq7YjH7jN_ihPPmLRymsIVnND9DW1ob8ZUk"
},
"message": "account has been editor",
"status": true
}
/api/user/delete
會員帳號刪除,刪除已存在的帳號密碼
輸入參數
{
"email":"demo@test.com",
"password":"demo"
}
回傳
{
"account": {
"ID": 8,
"CreatedAt": "2019-10-06T09:52:00.872431Z",
"UpdatedAt": "2019-10-06T09:52:00.872431Z",
"DeletedAt": "2019-10-06T09:52:00.872431Z",
"email": "test1234@gmail.com",
"password": "",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2Vy9.lrlKLD-upq7YjH7jN_ihPPmLRymsIVnND9DW1ob8ZUk"
},
"message": "account has been delete",
"status": true
}
/api/chat/CreateChatInfo
新增圖表,圖表標頭保存到 database 中供調用
輸入參數
{
"chatName":"TestChat",
"xName":"Year",
"yName":"height"
}
回傳
{
"token":"{透過處理過的TestChat、Year、heigh}"
}
/api/chat/createChatData
圖表資料新增,透過圖表標頭的 token 將資料輸入進資料庫
輸入參數
{
"token":"{透過處理過的TestChat、Year、heigh}",
"x":1,
"y":2
}
回傳
{
"status": true
}
/api/chat/createList
得到圖表列表,得到目前資料庫中目前登入的使用者可以觀看的圖表清單
輸入參數
{
"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2Vy9.lrlKLD-upq7YjH7jN_ihPPmLRymsIVnND9DW1ob8ZUk"
}
回傳
{
"chatName1":"TestChat1",
"chatName2":"TestChat2",
....
}
/api/chat/getData
得到圖表資料,得到目前資料庫中目前登入的使用者可以觀看的圖表清單
輸入參數
{
"token":"{使用者的 token}",
"chatName":"TestChat1"
}
回傳
{
"x":1
"y":1
}
...
將會介紹版本控制工具 git 的操作與用途