This project is created from the NLW#06 of NodeJS
To run this project follow commands below:
yarn install
;yarn typeorm migration:run
;yarn dev
: this run the development server;
- I use Nodemon with TS-Node instead TS-Node-Dev;
- Add ESLint configuration (
.eslintrc
) and add hook to run ongit push
; - Custom folder structure;
- Use one controller for all CRUD services (
getAll
,getOne
,create
,update
anddelete
); - Use JOI to validate parameters and body of requests;
- I create 3 middlewares to validade the body, query parameters or url parameters;
- Set Babel to build;
- Use
classToClass
(formclass-transformer
package) to hide password on result of requests;
In package.json
add on scripts:
"postinstall": "husky install",
After that run on your terminal:
- With Yarn:
yarn husky add .husky/pre-push "yarn lint"
yarn husky add .husky/pre-commit "yarn lint-staged"
- With NPM:
npx husky add .husky/pre-push "npm run lint
npx husky add .husky/pre-commit "npm lint-staged