meshblu-server-http
Version:
Maybe. Unofficial. You know how it is.
29 lines (22 loc) • 829 B
text/coffeescript
JobManager = require 'meshblu-core-job-manager'
MeshbluAuthParser = require '../helpers/meshblu-auth-parser'
debug = require('debug')('meshblu-server-http:messages-controller')
class MessagesController
constructor: ({}) ->
= new MeshbluAuthParser
create: (req, res) =>
jobManager = new JobManager
client: req.connection
timeoutSeconds:
auth = .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