https://github.com/allanvillatoro/nodewebinar
This project serves as a demonstration of best practices in modern Node.js and TypeScript development, with a strong focus on code quality, maintainability, and automated testing
https://github.com/allanvillatoro/nodewebinar
continuous-integration formatting github-actions integration-testing linting typescript unit-testing
Last synced: 2 months ago
JSON representation
This project serves as a demonstration of best practices in modern Node.js and TypeScript development, with a strong focus on code quality, maintainability, and automated testing
- Host: GitHub
- URL: https://github.com/allanvillatoro/nodewebinar
- Owner: allanvillatoro
- Created: 2025-02-02T04:23:55.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-20T03:41:40.000Z (over 1 year ago)
- Last Synced: 2025-02-20T04:28:59.191Z (over 1 year ago)
- Topics: continuous-integration, formatting, github-actions, integration-testing, linting, typescript, unit-testing
- Language: TypeScript
- Homepage:
- Size: 114 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Improving code quality in Node.js
This project serves as a demonstration of best practices in modern Node.js and TypeScript development, with a strong focus on code quality, maintainability, and automated testing. It incorporates the following key practices and tools:
- `Strict TypeScript Configuration` – Enforcing type safety and catching potential errors at compile time.
- `Code Formatting & Linting` – Using ESLint and Prettier to maintain a consistent code style.
- `Pre-commit Hooks` – Utilizing Husky to ensure code quality checks before commits.
- `Testing Strategy` – Implementing both unit tests and integration tests to verify functionality.
- `Continuous Integration` – Leveraging GitHub Actions to automate tests and quality checks on every push and pull request.
- `Code Analysis with SonarCloud` – Ensuring code reliability, security, and maintainability.
By integrating these tools and workflows, this project demonstrates how to build a robust, scalable, and well-tested Node.js application.
## Installation
```bash
# install dependencies
$ npm ci
```
## Running the app
```bash
# start postgres docker container
$ npm run localdb:up
# start app locally
$ npm run dev
```
## Running tests
```bash
# unit tests
$ npm run test
# unit test coverage
$ npm run test:coverage
# integration tests
$ npm run testdb:up
$ npm run test:integration
```
[Check Unit Testing Handbook](./docs/UNIT_TESTS.md)
## About the application
This application allows you to create a movie database. Anonymous uses can review every movie with a rating and comments.
### Routes:
1. **Movies:**
- **POST `/movies`**: To add a new movie.
- **PUT `/movies/:movieId`**: To update an existing movie.
- **GET `/movies/topfive`**: To get the top 5 highest-rated movies.
- **GET `/movies/:movieId`**: To get a movie by its ID.
- **GET `/movies`**: To get all movies.
2. **Movie Reviews:**
- **POST `/movies/reviews`**: To add a new review for a movie.
- **PUT `/movies/reviews/:movieReviewId`**: To update an existing review.
- **GET `/movies/reviews/:movieReviewId`**: To get a review by its ID.
- **GET `/movies/:movieId/reviews`**: To get all reviews for a specific movie.
- **DELETE `/movies/:movieId/reviews`**: To delete all reviews for a specific movie.
[Check Postman documentation](https://documenter.getpostman.com/view/818109/2sAYX9ogPD)