Showing
10 changed files
with
58 additions
and
0 deletions
server/.gitignore
0 → 100644
server/index.js
0 → 100644
1 | +const Koa = require('koa'); | ||
2 | +const Router = require('koa-router'); | ||
3 | +const bodyparser = require('koa-bodyparser'); | ||
4 | + | ||
5 | +const Mongoose = require('mongoose'); | ||
6 | + | ||
7 | +require('dotenv').config(); | ||
8 | +const { SERVER_PORT, MONGO_URL } = process.env; | ||
9 | + | ||
10 | +const app = new Koa(); | ||
11 | +const router = new Router(); | ||
12 | + | ||
13 | +const api = require('./src/api'); | ||
14 | + | ||
15 | +Mongoose.connect(MONGO_URL, { | ||
16 | + useNewUrlParser : true, | ||
17 | + useUnifiedTopology: true, | ||
18 | + useCreateIndex : true | ||
19 | +}).then(() => { | ||
20 | + console.log('Mongo DB is connected'); | ||
21 | +}).catch(e => { | ||
22 | + console.log(e, error); | ||
23 | +}) | ||
24 | + | ||
25 | +app.use(bodyparser()); | ||
26 | +router.use('/api', api.routes()); | ||
27 | +app.use(router.routes()).use(allowedMethods()); | ||
28 | + | ||
29 | +app.listen(SERVER_PORT, () => { | ||
30 | + console.log(SERVER_PORT, 'is connected'); | ||
31 | +}) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
server/package.json
0 → 100644
1 | +{ | ||
2 | + "name": "server", | ||
3 | + "version": "1.0.0", | ||
4 | + "description": "for Smart Medicine Bottle IoT Server", | ||
5 | + "main": "index.js", | ||
6 | + "scripts": { | ||
7 | + "start" : "node index", | ||
8 | + "test": "node test" | ||
9 | + }, | ||
10 | + "repository": { | ||
11 | + "type": "git", | ||
12 | + "url": "http://khuhub.khu.ac.kr/2021-1-capstone-design1/RIT_Project1.git" | ||
13 | + }, | ||
14 | + "keywords": [ | ||
15 | + "IoT" | ||
16 | + ], | ||
17 | + "author": "박권수", | ||
18 | + "license": "ISC" | ||
19 | +} |
server/src/api/auth/auth.ctrl.js
0 → 100644
File mode changed
server/src/api/auth/index.js
0 → 100644
File mode changed
server/src/api/hub/hub.ctrl.js
0 → 100644
server/src/api/hub/index.js
0 → 100644
File mode changed
server/src/api/index.js
0 → 100644
File mode changed
server/src/api/medicine/index.js
0 → 100644
File mode changed
server/src/api/medicine/medicine.ctrl.js
0 → 100644
File mode changed
-
Please register or login to post a comment