Skip to content
Permalink
Browse files
commit index.js
  • Loading branch information
kailad committed Nov 30, 2019
1 parent 0413176 commit b8597894b7c1e42b191186f433d5735d6f46ffe7
Showing 1 changed file with 15 additions and 0 deletions.
@@ -17,6 +17,7 @@ const alert = require('alert-node');
/* IMPORT CUSTOM MODULES */
const User = require('./modules/user')
const Lights = require('./modules/lights')
const Temp = require('./modules/temp')

const app = new Koa()
const router = new Router()
@@ -124,6 +125,20 @@ router.post('/MontionSensor', async ctx => {
}
})

router.get('/temp', async ctx => {
try {
let data = {}
const temp = await new Temp(dbName)
data = await temp.reading()
alert('Sensor set')
console.log(data)
await ctx.render('temp', data)
}
catch(err) {
await ctx.render('error', {message: err.message})
}
})

/**
* The script to process new user registrations.
*

0 comments on commit b859789

Please sign in to comment.