This backend app has a structure based on a clean architecture because this one allows us to create a simple solution adaptive, and keep the core business or application logic use cases independent of frontend and external frameworks.
app
- infrastructure
- driving-adapter
- implementation
- modules
- competition
- appplication
- domain
- entities
- exceptions
- repositories
- services
- player
- appplication
- domain
- entities
- exceptions
- repositories
- team
- entities
- exceptions
- repositories
- Node.js v16
- Express as framework
- Sequelize as ORM
- Mysql v8
- Typescript
- Dependency: Installing them with the below command:
npm i
- Database: The DB credentials are in the
src/db/config/config.json
file and before running the migration, create a DB and a user (with all the schema privileges) based the file specification. Then run the below command:
cd src/db && npx sequelize-cli db:migrate && cd ../..
- Running: With the below command the app'll be running on
http://localhost:3000
npm start
- To feed the DB with data based on the football API
/api/competition/importLeague/:codeLeague
- To get all the players regarding a the
codeLeague
andteamName
parameters
/api/player/getAllByLeague/:codeLeague?teamName=Fort
- To get all the players regarding a
teamName
parameter
/api/player/getAllBy?teamName=Fort
- To get all the teams regarding a
teamName
parameter
/api/team/getAllBy?teamName=Fort