박권수

start. server

.env
./node_modules
*.log
\ No newline at end of file
const Koa = require('koa');
const Router = require('koa-router');
const bodyparser = require('koa-bodyparser');
const Mongoose = require('mongoose');
require('dotenv').config();
const { SERVER_PORT, MONGO_URL } = process.env;
const app = new Koa();
const router = new Router();
const api = require('./src/api');
Mongoose.connect(MONGO_URL, {
useNewUrlParser : true,
useUnifiedTopology: true,
useCreateIndex : true
}).then(() => {
console.log('Mongo DB is connected');
}).catch(e => {
console.log(e, error);
})
app.use(bodyparser());
router.use('/api', api.routes());
app.use(router.routes()).use(allowedMethods());
app.listen(SERVER_PORT, () => {
console.log(SERVER_PORT, 'is connected');
})
\ No newline at end of file
{
"name": "server",
"version": "1.0.0",
"description": "for Smart Medicine Bottle IoT Server",
"main": "index.js",
"scripts": {
"start" : "node index",
"test": "node test"
},
"repository": {
"type": "git",
"url": "http://khuhub.khu.ac.kr/2021-1-capstone-design1/RIT_Project1.git"
},
"keywords": [
"IoT"
],
"author": "박권수",
"license": "ISC"
}
const mqtt = require('mqtt');
const MqttConnect = async (ctx) => {
const { host } = ctx.request.body;
}
\ No newline at end of file
File mode changed