Added /reset endpoint to reset device state.
This commit is contained in:
parent
7ac642ee30
commit
f2f5d583ce
9
index.js
9
index.js
|
@ -31,6 +31,7 @@ function createServer () {
|
|||
app.post('/frame', rFrame)
|
||||
app.get( '/sequence', () => {})
|
||||
app.post('/sequence', () => {})
|
||||
app.post('/reset', rReset)
|
||||
app.get( '/status', rStatus)
|
||||
app.listen(PORT, () => {
|
||||
log.info('server', { name : APPNAME, port : PORT })
|
||||
|
@ -203,6 +204,14 @@ function rStatus (req, res, next) {
|
|||
return next()
|
||||
}
|
||||
|
||||
function rRest (req, res, next) {
|
||||
intval.reset()
|
||||
setTimeout(() => {
|
||||
res.send(intval._state)
|
||||
return next()
|
||||
}, 10)
|
||||
}
|
||||
|
||||
function index (req, res, next) {
|
||||
fs.readFile(INDEXPATH, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
|
|
Loading…
Reference in New Issue