1.0.1 • Published 3 years ago

ftekos-cameras v1.0.1

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

FTekOS Cameras

This microservice handles cameras, camera groups, io nodes casting and VMS integrations.

Requirements

Node 10+
MongoDB 4

Dependencies

ftekos-services
ftekos-io
ftekos-actions
Swagger CLI (optional)

Setup

  • cp .env.dist .env
  • Update .env information
  • npm install

Commands

  • Run/Development - npm run dev
  • Run/Production - npm start
  • Build - npm run build
  • Unit Tests - npm run test
  • Unit Tests with Coverage - npm run coverage

Postman

Generate postman documentation from the Open API spec 1. Open postman and click "Import" 1. Drag or search for the open api spec located in public/docs/index.bundle.json 1. Make sure "Generate collection from imported APIs" is checked 1. Click "Show advanced settings", change "Folder organization" to "Tags" then click "Import"

Open API

The API documentation is in public/docs. Swagger CLI is required to update the documentation.

  • npm run openapi:validate to validate the definitions.
  • npm run openapi:bundle to bundle the documentation into a single file.
  • openapi-generator generate -i public/docs/index.bundle.json -g typescript-axios -o ~/my-typescript-sdk to generate an SDK from the Open API spec. See the OpenAPI Generator docs for installation, options and a full list of generators

Socket subscriptions

The events below are dispatched through socketio.

camera.save - Camera is created or updated
camera.remove - Camera is removed
camera.updateMany - Many cameras are updated
camera.removeMany - Many cameras are removed
cameraGroup.save - Camera Group is created or updated
cameraGroup.remove - Camera Group is removed
ioNode.save - IO Node is created or updated
ioNode.remove - IO Node is removed

Example

See socketio installation guide for more information.
npm install socket.io-client

import SocketIOClient from "socket.io-client";  
const socket = SocketIOClient('http://myhost');
socket.on('camera.save', (camera) => {
  console.log(camera);
});

© 2020 FrankenTek Inc. All rights reserved