UNPKG

meshblu-server-http

Version:

Maybe. Unofficial. You know how it is.

24 lines (18 loc) 678 B
MeshbluAuthParser = require '../helpers/meshblu-auth-parser' debug = require('debug')('meshblu-server-http:messages-controller') class MessagesController constructor: ({@jobManager}) -> @authParser = new MeshbluAuthParser create: (req, res) => auth = @authParser.parse req options = metadata: auth: auth fromUuid: auth.uuid toUuid: auth.uuid jobType: 'SendMessage' data: req.body @jobManager.do 'request', 'response', options, (error, response) => return res.status(error.code ? 500).send(error.message) if error? res.status(response.metadata.code).end() module.exports = MessagesController