Skip to content

Jakub-Vacek/MonitorService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

15ee969 · Sep 30, 2020

History

24 Commits
Sep 30, 2020
Jul 15, 2020
Apr 4, 2020
Apr 4, 2020
Jun 22, 2020
Jul 15, 2020
Jul 15, 2020
Apr 4, 2020
Jul 15, 2020
Apr 4, 2020
Apr 4, 2020
Apr 4, 2020
Apr 4, 2020
Apr 4, 2020
Sep 30, 2020
Jul 20, 2020
Jul 20, 2020
Apr 4, 2020
Apr 4, 2020
Apr 4, 2020
Jul 15, 2020

Repository files navigation

Description

Simple test server for monitoring urls. Uses MySql, Restify, Jest, TypeORM, Inversify.

Structure

  • authorization - service for token authorization

  • database - database layer, every entity has its model and repository, DatabaseProvider provides entity repository for service layer

  • http - simple axios service for getting responses from monitored endpoint url

  • logger - simple winston logger

  • monitor - monitor service handles monitoring of endpoint. Each instance of MonitoredJob is responsible for monitoring one monitored endpoint

  • monitored-endpoint - monitored-endpoint service layer

  • monitoring-result - monitoring-result service layer

  • validation - services for monitored endpoint validation. Based on class-validator/class-transformer

  • web - handles user interaction with server

  • inversify.config - class responsible for configuration of Inversiy container

  • app - application entrypoint

  • server - represents application server

Routes

Installation

npm install

Build

npm run build

Run

npm start

Test

Basic unit tests using Jest

npm test

Docker

docker-compose up -d
docker-compose up --build

Curl

get monitored endpoints

curl -H "Authorization: Bearer 93f39e2f-80de-4033-99ee-249d92736a25" http://localhost:3000/monitored-endpoints

create monitored endpoint

 curl -H "Authorization: Bearer 93f39e2f-80de-4033-99ee-249d92736a25" -H "Content-Type: application/json" -d '{"name": "test", "url": "http://private-264465-litackaapi.apiary-mock.com/cards/1/state", "monitoredInterval": 3}' http://localhost:3000/monitored-endpoints

update monitored endpoint

curl -X PUT  -H "Authorization: Bearer 93f39e2f-80de-4033-99ee-249d92736a25" -H "Content-Type: application/json" -d '{"name": "test", "url": "http://private-264465-litackaapi.apiary-mock.com/cards/1/state", "monitoredInterval": 3}' http://localhost:3000/monitored-endpoints/1/

delete monitored endpoint

curl -X DELETE  -H "Authorization: Bearer 93f39e2f-80de-4033-99ee-249d92736a25" -H "Content-Type: application/json" http://localhost:3000/monitored-endpoints/1/

get monitoring results

curl  -H "Authorization: Bearer 93f39e2f-80de-4033-99ee-249d92736a25" http://localhost:3000/monitored-endpoints/1/monitoring-results

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages