lamassu-server/lib/middlewares/pair.js
Cesar 85235eaa13 Feat: refactor routes.js express entrypoint config
Feat: express config script refactor

Feat: add state and settingsCache files
2021-03-19 14:04:31 +00:00

20 lines
No EOL
420 B
JavaScript

const pairing = require('../pairing')
function pair (req, res, next) {
console.log("pair")
const token = req.query.token
const deviceId = req.deviceId
const model = req.query.model
return pairing.pair(token, deviceId, model)
.then(valid => {
if (valid) {
return res.json({ status: 'paired' })
}
throw httpError('Pairing failed')
})
.catch(next)
}
module.exports = pair