Skip to content

Instantly share code, notes, and snippets.

@OsvaldoFrias
Last active October 26, 2021 17:19
Show Gist options
  • Save OsvaldoFrias/0b8d39caaea43b68498aa8eb0df6aa12 to your computer and use it in GitHub Desktop.
Save OsvaldoFrias/0b8d39caaea43b68498aa8eb0df6aa12 to your computer and use it in GitHub Desktop.
Express server with SecurOS core integration, requires npm express installation
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