|
22 | 22 | <!--[](https://opencollective.com/nest#backer) |
23 | 23 | [](https://opencollective.com/nest#sponsor)--> |
24 | 24 |
|
25 | | -### Simple Blog API ( CRUD users, users CRUD posts ) |
| 25 | +### Simple Blog API ( CRUD users, users CRUD posts, users upload files ) |
26 | 26 |
|
27 | 27 | > [Prisma](https://docs.nestjs.com/recipes/prisma) [GraphQL schema-first](https://docs.nestjs.com/graphql/quick-start#schema-first) [Hybrid application](https://docs.nestjs.com/faq/hybrid-application) |
28 | 28 |
|
29 | | -This hybrid project uses graphql API query language for clean responses, TCP transport layer for microservice, `@nestjs/testing` which uses jest for unit testing and mysql as the relational database. |
| 29 | +This hybrid project uses GraphQL API query language for clean responses, TCP transport layer for microservice, `@nestjs/testing` which uses jest for unit testing and MySQL as the relational database and MongoDB as no-sql database for constantly changing or growing data such as posts. |
30 | 30 |
|
31 | 31 | To connect other microservices uncomment examples in `main.ts`, replace jest with vitest and to use a different database, check the [Prisma docs](https://www.prisma.io/docs/getting-started) e.g. |
32 | 32 |
|
@@ -56,15 +56,37 @@ datasource db { |
56 | 56 |
|
57 | 57 | ### Installation |
58 | 58 |
|
59 | | -1. Install dependencies: `npm install` |
60 | | -2. Generate TypeScript type definitions for the GraphQL schema: `npm run generate:typings` |
61 | | -3. Generate a type-safe client to interact with your database: `npm run prisma:gen` |
62 | | -4. Create mariadb/mysql database and create tables: `npm run prisma:push` |
63 | | -5. Start server: `npm run start:dev` |
| 59 | +1. Run multi-container Docker applications |
| 60 | + |
| 61 | +```bash |
| 62 | +# run mongodb, mongo express container |
| 63 | +$ docker-compose -f docker-compose-mongo.yml up -d |
| 64 | +# run mysql, phpmyadmincontainer |
| 65 | +$ docker-compose up -d |
| 66 | + |
| 67 | +``` |
| 68 | +2. Install dependencies: `npm install` |
| 69 | +3. Generate TypeScript type definitions for the GraphQL schema: `npm run generate:typings` |
| 70 | +4. Generate a type-safe client to interact with your database: `npm run prisma:gen` |
| 71 | +5. Create mariadb/mysql database and create tables: `npm run prisma:push` |
| 72 | +6. Start server: `npm run start:dev` |
| 73 | + |
| 74 | +## Test |
| 75 | + |
| 76 | +```bash |
| 77 | +# unit tests |
| 78 | +$ npm run test |
| 79 | + |
| 80 | +# e2e tests |
| 81 | +$ npm run test:e2e |
| 82 | + |
| 83 | +# test coverage |
| 84 | +$ npm run test:cov |
| 85 | +``` |
64 | 86 |
|
65 | 87 | ### Graphql Playground |
66 | 88 |
|
67 | | -When the application is running, you can go to [http://localhost:3000/graphql](http://localhost:3001/graphql) to access the GraphQL Playground. See [here](https://docs.nestjs.com/graphql/quick-start#playground) for more. |
| 89 | +When the application is running, you can go to [http://localhost:3001/graphql](http://localhost:3001/graphql) to access the GraphQL Playground. See [here](https://docs.nestjs.com/graphql/quick-start#playground) for more. |
68 | 90 |
|
69 | 91 |
|
70 | 92 | **Create a New User** |
|
0 commit comments