Last active
October 26, 2021 17:19
-
-
Save OsvaldoFrias/0b8d39caaea43b68498aa8eb0df6aa12 to your computer and use it in GitHub Desktop.
Express server with SecurOS core integration, requires npm express installation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const PORT = 3001; | |
const securos = require("securos"); | |
securos.connect(function (core) { | |
var express = require('express'); | |
var bodyParser = require('body-parser'); | |
var app = express(); | |
app.use(express.json()); | |
app.use(express.urlencoded({ extended: true })); | |
app.get('/', function (req, res) { | |
res.send('Server up'); | |
}); | |
app.post('/', async function (req, res) { | |
let params = { | |
comment: '1234' | |
}; | |
core.sendEvent("CAM", camId, "VCA_EVENT", params); | |
res.send(req.body); | |
}); | |
app.listen(PORT, function () { | |
console.log(`Aplicación ejemplo, escuchando el puerto ${PORT}!`); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment