Hi! Welcome to my labo.
This is a very small Nodejs api to manage Hockey team.
I programed this project to discover Fastify and TypeORM.
Note: I took my inspiration by a test created by Maplr: https://github.com/Maplr-Community/nodejs-test-hockey-game
- Nodejs
- Typescript
- Fastify
- TypeORM
- Postgress
- Jest
- Docker-compose
- Nodejs (17.0.1)
- Yarn (1.22.17) or npm
- Docker (20.10.10)
- Docker-compose (2.1.1)
(Version numbers are just my versions)
You just need to follow next commands to run the api on your computer.
docker-compose up -d
yarn
yarn dev
yarn test
yarn lint
You can find some integration/e2e tests on __tests__integration/api
.
To execute them, it's required to start a postgres database server. It's possible to start it with docker-compose up -d
.
I like this kind of test because I can easly change my code architecture without changing my tests. They are integration tests and functionnal tests too.
Now my code base is established, I can easly play with the code architecture and change it with security of my functionnal tests...
I didn't take time to make a great architecture. A lot of business code should not be in controllers for example.
- Create more DTO and mappers to map DTO to entities
- Move business code into service layer. No in controllers
- Add a fastify plugin to automatically import plugins and controllers
- Add a fastify plugin to add Swagger documentation
Anthony Godin