Fix: add missing coupon routes
This commit is contained in:
parent
558317e9f3
commit
afb5ceea71
2 changed files with 2 additions and 2 deletions
25
lib/routes/pairingRoutes.js
Normal file
25
lib/routes/pairingRoutes.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
const express = require('express')
|
||||
const router = express.Router()
|
||||
|
||||
const ca = require('../middlewares/ca')
|
||||
const httpError = require('../route-helpers').httpError
|
||||
const pairing = require('../pairing')
|
||||
const populateDeviceId = require('../middlewares/populateDeviceId')
|
||||
|
||||
function pair (req, res, next) {
|
||||
const token = req.query.token
|
||||
const deviceId = req.deviceId
|
||||
const model = req.query.model
|
||||
|
||||
return pairing.pair(token, deviceId, model)
|
||||
.then(isValid => {
|
||||
if (isValid) return res.json({ status: 'paired' })
|
||||
throw httpError('Pairing failed')
|
||||
})
|
||||
.catch(next)
|
||||
}
|
||||
|
||||
router.post('/pair', populateDeviceId, pair)
|
||||
router.get('/ca', ca)
|
||||
|
||||
module.exports = router
|
||||
Loading…
Add table
Add a link
Reference in a new issue