-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from amandastecz/tests/implementation
Tests/implementation
- Loading branch information
Showing
3 changed files
with
53 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,58 @@ | ||
## Wiki | ||
[For more information, check the project's wiki.](https://github.com/amandastecz/rentapi/wiki/) | ||
## Project Overview | ||
|
||
## API Documentation | ||
Welcome to the RentAPI repository! This project is part of a series of personal studies on Node.js, aimed at showcasing a range of advanced concepts and practical applications. The RentAPI is developed with TypeScript, adhering to the foundational principles of Clean Architecture and S.O.L.I.D. The project encompasses REST API design, file handling via streams, communication with PostgreSQL databases using TypeORM, injectable containers, JWT authentication with refresh tokens, and meticulous API documentation with Swagger. The application is fortified with automated tests, spanning both unit and integration levels, seamlessly integrated with the Jest Framework. | ||
|
||
[Check the API documentation on Swagger UI](http://18.231.189.148/api-docs/) | ||
|
||
## NodeJs - Rent API | ||
## Technical specification | ||
|
||
This project is part of a series of personal studies on Node.js. This project is being developed with Typescript, applying principles of Clean Architecture and S.O.L.I.D, API Rest, import and reading of files in stream, communication with PostgreSQL database through TypeORM, containerization with Docker, refresh token with JWT authentication, in addition to all the API documentation with Swagger and automated tests at unit and integration level with Jest Framework. | ||
- **Design**: Guided by Clean Architecture, Clean Code, Test Patterns, and S.O.L.I.D principles. | ||
- **Architecture**: Powered by Express, Node.js, and TypeScript. Communicates seamlessly with PostgreSQL using TypeORM. Utilizes Jsonwebtoken for authentication and Nodemailer for efficient email communication. | ||
- **Documentation Framework**: Swagger ensures clear API documentation. | ||
- **Testing Frameworks**: Embraces Jest and Supertest for comprehensive testing. | ||
- **Infrastructure**: Seamlessly integrates with AWS services like EC2, S3, and SES. Simplifies deployment through Docker. | ||
- **CI/CD**: GitHub Actions streamline the development workflow. | ||
- **Security Measures**: Rate-limiter-flexible and Redis enhance security and data management. | ||
|
||
### SOLID - Robert C. Martin (Uncle Bob) - Applied Principles | ||
- [X] S: SRP: Single Responsibility Principle - Single responsibility (separation by context) | ||
- [X] L: LSP: Liskov Substitution Principle - Liskov Substitution Principle, talks about using contracts (class implementing interfaces)! | ||
- [X] D: DIP: Dependency Inversion Principle - Dependency Inversion Principle, also means that what is at a high level does not need to know what is at a low level, that is, services do not need to know the repository, the responsibility passes for who calls the service | ||
For deeper insights, delve into the [project's wiki](https://github.com/amandastecz/rentapi/wiki/). | ||
|
||
### Docker | ||
- To run the application image: `docker-compose up` | ||
# Running the RentAPI project locally | ||
|
||
- up: Creates the container | ||
- down: Removes the container | ||
- start: Starts the container | ||
- stop: Stops the container | ||
Follow these steps to get the RentAPI project up and running on your local machine: | ||
|
||
### Migrations | ||
- To create a migration run: `yarn run typeorm migration:create -n CreateCategories` | ||
- To run the migration run: `yarn run typeorm migration:run` | ||
### 1. Install Dependencies | ||
|
||
### Seeds | ||
- To create an admin user, run: `yarn run seed:admin` | ||
Open a terminal and navigate to the project's root directory. Run the following command to install all required dependencies: | ||
|
||
```bash | ||
yarn | ||
``` | ||
|
||
### 2. Set Up Database and Caching | ||
|
||
Run the following command to create the PostgreSQL database and Redis images necessary for the project: | ||
|
||
```bash | ||
docker-compose up | ||
``` | ||
|
||
### 3. Run Migrations | ||
After setting up the database, execute the following command to run all migrations and set up the database schema: | ||
|
||
```bash | ||
yarn run typeorm migration:run | ||
``` | ||
|
||
### 4. Populate Database | ||
Populate the database with an admin user by running the following command: | ||
```bash | ||
yarn run seed:admin | ||
``` | ||
This step ensures that you have initial data for testing and development. | ||
### 5. Start the Server | ||
To start the server and launch the application, use the following command: | ||
```bash | ||
yarn dev | ||
``` | ||
|
||
With these steps completed, you'll have the RentAPI project running on your localhost, ready for exploration, testing, and development. Feel free to dive into the codebase and API documentation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters