Simple test server for monitoring urls. Uses MySql, Restify, Jest, TypeORM, Inversify.
-
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
-
http://localhost:3000/monitored-endpoints - GET/POST - get/create monitored endpoint
-
http://localhost:3000/monitored-endpoints/:id - PUT/DELETE - update/delete monitored endpoint
-
http://localhost:3000/monitored-endpoints/:id/monitoring-results/ - GET - get monitoring results from monitored endpoint with specified id
npm install
npm run build
npm start
Basic unit tests using Jest
npm test
docker-compose up -d
docker-compose up --build
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