REST API_Lonelyonemeal
Login
POST
https://onemeal.site/users/login
Client 로그인 요청.
Request Body
string
User email value
password
string
User password value
{ "message" "Login successfully" }
Logout
POST
https://onemeal.site/users/logout
Client 로그아웃 요청.
Headers
Content-Type
string
application/json
withCredentials
string
true
{ "message": "Logout successfully" }
SignUp
POST
https://onemeal.site/users/signup
Client 유저 회원 가입 요청.
Request Body
username
string
User username value
string
User email value
password
string
User password value
{ "message": "Sign successfully" }
UserInfo
GET
https://onemeal.site/users/userinfo
Client 로그인 후 생성 Session.userId로 유저 정보 요청.
Headers
withCredentials
string
true
{
"data": {
id: "1",
userImg: "34058023858.jpg",
email: "test@test.com",
username: "홍길"
},
"log": [
{
id: "4"
foodName: "스팸마요덮밥",
foodImg: "https://i.imgur.com/U89ed7j.jpg",
link: "https://www.youtube.com/watch?v=TkElH6dFhW8",
createdAt: "2020-12-30 12:50:26",
updatedAt: "2020-12-30 12:50:26"
},
{
id: "7"
foodName: "고추장불고기",
foodImg: "https://i.imgur.com/oVmADMs.jpg",
link: "https://www.youtube.com/watch?v=bQDQXAQxO6A",
createdAt: "2020-12-30 12:50:26",
updatedAt: "2020-12-30 12:50:26"
},
]
}
UserInfoUp
PUT
https://onemeal.site/users/userinfoup
Client username, Password 변경 후 응답.
Headers
session.userId
string
Request Body
username
string
password
string
{ "data": "홍길" }
UserImgUp
PUT
https://onemeal.site/users/userImgUp
Client 유저 Img 업데이트 후 응답.
Path Parameters
userImg
string
{ data : {
id: "1",
userImg: "34058023858.jpg",
email: "test@test.com",
username: "홍길"
}
}
GithubAuthorize
GET
https://github.com/login/oauth/authorize?client_id=
Client의 state에 "https://github.com/login/oauth/authorize?client_id=" 로 사용자 인증하면 설정해논 EndPoint로 리다이렉션 되면서 Athorization code를 받아오게 됩니다.
Path Parameters
client_id
string
Developer settings Github Client ID
GithubLogin
POST
/socials/githublogin
Client Oauth인증이 완료된 후 얻은 authorization code(url.searchParams.get('code'))를 Server에 전달 후 AccessToken을 받기위한 Endpoint
Request Body
authorizationCode
string
authorizationCode
{ accessToken: github.data.access_token }
GithubUserInfo
GET
https://api.github.com/user
Server로 부터 받은 AccessToken으로 Github 유저 정보 요청.
Headers
authorization
string
`token ${this.props.accessToken}`
{ result: result.data }
GoogleAuthorize
GET
https://accounts.google.com/o/oauth2/v2/auth/client_id?=
Client의 state에 "https://accounts.google.com/o/oauth2/v2/auth?client_id="로 사용자 인증을 하면 설정해놓은 EndPoint로 리다이렉션 되면서 Athorization code를 받아오게 됩니다.
Path Parameters
client_id
string
Google API Developer Client ID
https://oauth2.example.com/auth?code=4/P7q7W91a-oMsCeLvIaQm6bTrgtp7
GoogleLogin
POST
/socials/googleLogin
Client Ouath인증 완료 후 얻은 authorization code(url.serchParams.get('code'))를 Server에 전달 후 AccessToken을 받기
Path Parameters
authorizationCode
string
authorizationCode
{ accessToken: google.data.access_token }
GoogleUserInfo
GET
https://www.googleapis.com/drive/v2/files
Server로 부터 받은 AccessToken으로 Google에 유저 정보 요청
Headers
Authorization
string
`Bearer ${this.props.accessToken}
{ result: result.data }
ResultRecipe
GET
https://onemeal.site/users/resultrecipe
Client 메인 페이지에서 유저가 선택한 재료에 따라 레시피 결과 응답.
Request Body
FoodParameter
string
Main page Select Food Parameter
{
"data": [
{
"id": 11,
"foodimg": "https://i.imgur.com/tgpIWMa.jpg",
"foodname": "김치전",
"link": "https://www.youtube.com/watch?v=V2TBTOf5hBM&list=PL88CEP-8JWFDCQ0pyvepo0JexIGlyTNEf&index=58",
"createdAt": "2020-12-30 12:50:26",
"updatedAt": "2020-12-30 12:50:26"
}
]
}
SaveRecipe
POST
https://onemeal.site/users/saverecipe
Client 메인 페이지에서 유저가 마이페이지에 레시피를 저장하는 버튼 클릭시.
Request Body
id
string
foodImg
string
foodName
string
link
string
{ message: "Save successfully" }
DeleteRecipe
POST
https://onemeal.site/users/deleterecipe
Headers
req.session.userId
string
Request Body
id
string
{ message: "Completed recipeLog delete" }
Last updated
Was this helpful?