Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
RIT_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박권수
2021-05-05 16:41:38 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6c2eb5bc7e4349d52712987f4cdb03a0a051da77
6c2eb5bc
1 parent
99dda3f1
feat. api architecture architected
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
134 additions
and
3 deletions
server/src/api/auth/auth.ctrl.js
server/src/api/auth/index.js
server/src/api/bottle/bottle.ctrl.js
server/src/api/bottle/index.js
server/src/api/hub/hub.ctrl.js
server/src/api/hub/index.js
server/src/api/index.js
server/src/api/medicine/index.js
server/src/api/medicine/medicine.ctrl.js
server/src/api/auth/auth.ctrl.js
View file @
6c2eb5b
//회원가입, 로그인 및 로그아웃에 관한 api
const
User
=
require
(
'../../models/user'
);
const
Joi
=
require
(
'joi'
);
const
jwt
=
require
(
'jsonwebtoken'
);
exports
.
register
=
async
(
ctx
)
=>
{
ctx
.
body
=
'register'
};
exports
.
login
=
async
(
ctx
)
=>
{
ctx
.
body
=
'login'
};
exports
.
logout
=
async
(
ctx
)
=>
{
ctx
.
body
=
'logout'
};
\ No newline at end of file
...
...
server/src/api/auth/index.js
View file @
6c2eb5b
const
Router
=
require
(
'koa-router'
);
const
authCtrl
=
require
(
'./auth.ctrl'
);
const
auth
=
new
Router
();
auth
.
post
(
'/register'
,
authCtrl
.
register
);
auth
.
post
(
'/login'
,
authCtrl
.
login
);
auth
.
post
(
'/logout'
,
authCtrl
.
logout
);
module
.
exports
=
auth
;
\ No newline at end of file
...
...
server/src/api/bottle/bottle.ctrl.js
0 → 100644
View file @
6c2eb5b
//어플에서 약병 등록 및, 약병에 관한 정보 조회 = 여기서 mqtt통신으로 broker에 데이터를 요청한다.
const
Bottle
=
require
(
'../../models/bottle'
)
const
DataProcess
=
require
(
'../../lib/DataProcess'
);
const
MqttModule
=
require
(
'../../lib/MqttModule'
);
exports
.
lookupInfo
=
async
(
ctx
)
=>
{
/** toDO
* 약병 데이터를 요청한다
* 1. Broker에 데이터 요청
* 2. Broker에게서 받은 데이터를
* 3. 가공한 후
* 4. 유저에게 http response
*/
const
a
=
dataRequest
();
//1.
const
b
=
await
getData
();
const
c
=
await
dataProcess
();
ctx
.
body
=
{
a
,
b
,
c
}
}
const
dataRequest
=
()
=>
{
return
'dataRequest'
}
const
getData
=
async
()
=>
{
return
'getData'
}
const
dataProcess
=
async
()
=>
{
return
'dataProcess..'
}
server/src/api/bottle/index.js
0 → 100644
View file @
6c2eb5b
const
Router
=
require
(
'koa-router'
);
const
bottleCtrl
=
require
(
'./bottle.ctrl'
);
const
bottle
=
new
Router
();
bottle
.
post
(
'/lookupInfo'
,
bottleCtrl
.
lookupInfo
);
module
.
exports
=
bottle
;
\ No newline at end of file
server/src/api/hub/hub.ctrl.js
View file @
6c2eb5b
const
mqtt
=
require
(
'mqtt'
);
//허브(Mqtt Broker)등록 및 삭제
const
Hub
=
require
(
'../../models/hub'
);
const
MqttConnect
=
async
(
ctx
)
=>
{
c
onst
{
host
}
=
ctx
.
request
.
body
;
exports
.
hubRegister
=
async
(
ctx
)
=>
{
c
tx
.
body
=
'hubRegister'
}
\ No newline at end of file
...
...
server/src/api/hub/index.js
View file @
6c2eb5b
const
Router
=
require
(
'koa-router'
);
const
hubCtrl
=
require
(
'./hub.ctrl'
);
const
hub
=
new
Router
();
hub
.
post
(
'/register'
,
hubCtrl
.
hubRegister
);
module
.
exports
=
hub
;
\ No newline at end of file
...
...
server/src/api/index.js
View file @
6c2eb5b
const
Router
=
require
(
'koa-router'
);
const
auth
=
require
(
'./auth'
);
const
bottle
=
require
(
'./bottle'
);
const
hub
=
require
(
'./hub'
);
const
medicine
=
require
(
'./medicine'
);
const
api
=
new
Router
();
api
.
use
(
'/auth'
,
auth
.
routes
());
api
.
use
(
'/bottle'
,
bottle
.
routes
());
api
.
use
(
'/hub'
,
hub
.
routes
());
api
.
use
(
'/medicine'
,
medicine
.
routes
());
module
.
exports
=
api
;
\ No newline at end of file
...
...
server/src/api/medicine/index.js
View file @
6c2eb5b
const
Router
=
require
(
'koa-router'
);
const
medicineCtrl
=
require
(
'./medicine.ctrl'
);
const
medicine
=
new
Router
();
medicine
.
get
(
'/search'
,
medicineCtrl
.
medicineSearch
);
module
.
exports
=
medicine
;
\ No newline at end of file
...
...
server/src/api/medicine/medicine.ctrl.js
View file @
6c2eb5b
//해당하는 약의 정보를 불러오거나, 약을 검색
const
Medicine
=
require
(
'../../models/medicine'
);
exports
.
medicineSearch
=
async
(
ctx
)
=>
{
ctx
.
body
=
{
medicineSearch
:
'search..'
}
}
//이름으로 약 검색
const
medicineSearch_ByName
=
async
(
name
)
=>
{
}
//제조사명으로 약 검색
const
medicineSearch_ByCompany
=
async
(
company
)
=>
{
}
//효능으로 약 검색
const
medicineSearch_ByEfficacy
=
async
(
efficacy
)
=>
{
}
//타겟 병명으로 약 검색
const
medicineSearch_ByTarget
=
async
(
target
)
=>
{
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment