API Microservice responsible by match prediction and users leagues
Everything that linked with predictions.
About the users leagues.
The Guess Microservice have a user to guessDB Read and Write and to the holiDB read-only
- Node.js v8.x.x // NPM v5.X
- MongoDB v3.4
- Redis v3.2.6
- Env variables are always called at config, with Capitalize and Underscore
- Enums are used with Capitalize
- The function are accessed by module.exports, there are no dependency injection
- The file index.js is a pattern to export file
- There are no console.log or console.error, all console used is from Pino, a NPM installed
- The requires libs and variables at top file mandatorily need to follow the sequence: NPM modules, localFiles, Global Variables, Variables
- To all tests that is IO (InputOutput) tests, you must comment a description about the IO, like if a document need to exist in a DB
- To all IO tests, at test name it necessary to put [IO] at prefix
- Always that possible date/hour treatment should be coded at coincident dateManager
All functions and variables need to be in English
Responsible to declare Routes, with Rest Verb, url path, call the schemas and handler the request
Responsible to fix a schema pattern to response/request/headers. All route need to have schemas.
Responsible to response the request, error or success
Responsible to treat clientErrors, cache logic, some bussiness Rule, multiple repositories logic
Responsible fire events to get from Holi the championships, matchDays and matchDays results
Responsible to declare a collection pattern, indexes, requireds fields
Responsible by external connections, HTTP, SOAP, GraphQL, SQL, noSQL, etc.
- Anemic Models need to be avoided, it is possible elimine this layers if necessary
- There are a Schema for each Collection at MongoDB
app.js
src
βββ routes
β βββ login
β β βββ index.js
β β βββ signUpRoutes.js
β β βββ signInRoutes.js
| | βββ schemas.js
| | | βββ signUpSchemas.js
| | | βββ signInSchemas.js
β βββ availability
β β βββ index.js
β β βββ userNameAvailabilityRoutes.js
| | βββ schemas.js
| | | βββ userNameAvailabilitySchemas.js
βββ controllers
β βββ login
β β βββ signUpController.js
β β βββ signInController.js
β βββ availability
β β βββ userNameAvailabilityController.js
βββ services
β βββ login
β β βββ signUpService.js
β β βββ signInService.js
β βββ availability
β β βββ userNameAvailabilityService.js
βββ routines
β βββ updatePontuationRoutine
β β βββ cronTime.js
β β βββ updateGuessLinesPredictionsPontuationsRoutine.js
β β βββ functions
βββ models
β βββ profileModel.js
β βββ optionsModel.js
βββ repositories
β βββ login
β β βββ signUpRepository.js
β β βββ signInRepository.js
β βββ availability
β β βββ userNameAvailabilityRepository.js
test
βββ (TODO: terminar readMe )