This task implemented with SSE instead WS. Motivation:
- Based on the requirements we need only events from Server, so WS as duplex protocol is overhead.
- Based on the requirements we need auto-reconnection, SSE has that from the box.
- Project evolving will require subscriptions in WS. REST routing is simpler for implementation.
- Known SSE limitation resolved by using http2 and eventsource-polyfill
- The last, but not the least coincap already has WS API
Other notices:
- Scrapping timout decrised and added checking do we have new values.
- Frontend implemented with React as render library without bundling via WebPack.
- Node.js with LTS version. Right now 10.15.1
- npm version 6.4.1
- typescript for typechecking and support decorators, BigInt.
Project structure based on The Entity-Control-Boundary Pattern
- coincap - client for coincap api
- http2-server - server with http2 support. In production should be protected by Nginx.
Classes with class-transformer decorators for models from Domain.
Store last assets values.
We use The Twelve Factors manifest. Check .env.example
file and create .env
copy for local development.
Run npm run watch
. Auto any changes at src
folder nodemon will restart application.
npm run start
Run docker-compose up
- tslint is used for checking code style and TS best practice. Use
npm run lint-fix
for autofixing common tslint errors. - typescript is used for checking types.
- jest is not implemented, but planned.
This is test task. There are not autodeploy, but it can easily deploy to any Docker-based environment.