You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -30,71 +35,77 @@ So let's talk about the stack (pushing on an open door here, but hey):
30
35
31
36
## :zap: Guidelines
32
37
33
-
### :diamonds: Schema splitting
38
+
### 🔶 Schema splitting
34
39
35
40
We do not want a huge prisma schema. We want to isolate each model (table or set of tables) in its own file.
36
41
37
-
### :diamonds: Well documented routes
42
+
### 🔶 Well documented routes
38
43
39
44
Let's have a swagger documenting properly exposed routes, that is mainly for each route:
40
45
41
46
- a description.
42
47
- the list of possible responses.
43
48
- a definition of the inputs and outputs.
44
49
45
-
### :diamonds: Full testing coverage
50
+
### 🔶 Full testing coverage
46
51
47
52
We want to test everything to learn how to properly test, and to face every single difficulty that comes with testing. We will at very least do end to end using superagent, controllers testing, service testing.
48
53
49
-
### :diamonds: No testing against the database
54
+
### 🔶 No testing against the database
50
55
51
56
All tests should run without any interaction with a database.
52
57
53
58
## :zap: Usage
54
59
55
-
### :diamonds: run locally
60
+
### 🔶 run locally
56
61
57
-
:point_down: Since our prisma schemas are split within modules, we will have to merge them all in one file prisma can understand. Let's do just that:
62
+
#### 👇 Since our prisma schemas are split within modules, we will have to merge them all in one file prisma can understand. Let's do just that:
58
63
59
64
```bash
60
65
yarn prisma:merge
61
66
```
62
67
63
-
:point_down: Now, we need to tell prisma to generate in node_modules the code actually allowing us to interact with the database:
68
+
#### 👇 Now, we need to tell prisma to generate in node_modules the code actually allowing us to interact with the database:
64
69
65
70
```bash
66
71
yarn prisma:gen
67
72
```
68
73
69
-
:point_down: You will need docker and docker-compose to get the postgres database up and running. You can use this command to launch the database container:
74
+
#### 👇 You will need docker and docker-compose to get the postgres database up and running. You can use this command to launch the database container:
70
75
71
76
```bash
72
-
yarn dev:db
77
+
yarn docker
73
78
```
74
79
75
-
:point_down: Then, let's inject some data in our dev database using:
80
+
#### 👇 Then, let's inject some data in our dev database using:
76
81
77
82
```bash
78
83
yarn prisma:seed
79
84
```
80
85
81
-
:point_down: We can now launch the backend in dev:
86
+
#### 👇 We can now launch the backend in dev:
82
87
83
88
```bash
84
89
yarn dev
85
90
```
86
91
87
-
### :diamonds: test all the things
92
+
#### 😵 You can do the merge, gen & seed steps all at once using the following command:
93
+
94
+
```bash
95
+
yarn dev:db
96
+
```
97
+
98
+
### 🔶 test all the things
88
99
89
-
:point_down: We can run all the tests and get a coverage report using the following:
100
+
🔶 We can run all the tests and get a coverage report using the following:
90
101
91
102
```bash
92
103
yarn test:dev
93
104
```
94
105
95
106
## :zap: Subjects
96
107
97
-
### :diamonds: Authentication
108
+
### 🔶 Authentication
98
109
99
110
Let's use passport to setup jwt based authentication.
100
111
@@ -121,7 +132,7 @@ We have two users in database to play with the routes:
121
132
-:white_check_mark: services
122
133
-:white_check_mark: local passport strategy
123
134
124
-
### :diamonds: CRUD
135
+
### 🔶 CRUD
125
136
126
137
Let's create CRUD routes to manage a list of books.
127
138
We want to make sure to give a proper feedback when foreign keys violations do occur (when we try to delete an entry whose key is referenced in another table or when we try to update an entry with a foreign key that does not exist). Let's use filters for that!
0 commit comments