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
Copy file name to clipboardExpand all lines: libs/json-api-nestjs/README.md
+85-70Lines changed: 85 additions & 70 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,11 @@
1
1
# json-api-nestjs
2
2
3
-
This plugin works upon TypeOrm library, which is used as the main database abstraction layer tool. The module automatically generates an API according to JSON API specification from the database structure (TypeORM entities). It supports features such as requests validation based on database fields types, request filtering, endpoints extending, data relations control and much more. Our module significantly reduces the development time of REST services by removing the need to negotiate the mechanism of client-server interaction and implementing automatic API generation without the need to write any code.
3
+
This plugin works upon TypeOrm library, which is used as the main database abstraction layer tool. The module
4
+
automatically generates an API according to JSON API specification from the database structure (TypeORM entities). It
5
+
supports features such as requests validation based on database fields types, request filtering, endpoints extending,
6
+
data relations control and much more. Our module significantly reduces the development time of REST services by removing
7
+
the need to negotiate the mechanism of client-server interaction and implementing automatic API generation without the
8
+
need to write any code.
4
9
5
10
## Installation
6
11
@@ -13,21 +18,22 @@ $ npm install json-api-nestjs
13
18
Once the installation process is complete, we can import the **JsonApiModule** into the root **AppModule**.
14
19
15
20
```typescript
16
-
import {Module} from'@nestjs/common';
17
-
import {JsonApiModule} from'json-api-nestjs';
18
-
import {Users} from'database';
21
+
import {Module} from'@nestjs/common';
22
+
import {JsonApiModule} from'json-api-nestjs';
23
+
import {Users} from'database';
19
24
20
25
@Module({
21
26
imports: [
22
-
JsonApiModule.forRoot({
23
-
entities: [Users]
24
-
}),
27
+
JsonApiModule.forRoot({
28
+
entities: [Users]
29
+
}),
25
30
],
26
31
})
27
-
exportclassAppModule {}
32
+
exportclassAppModule {
33
+
}
28
34
```
29
-
After this, you have to prepare CRUDs with ready-to-use endpoints:
30
35
36
+
After this, you have to prepare CRUDs with ready-to-use endpoints:
31
37
32
38
- GET /users
33
39
- POST /users
@@ -42,54 +48,57 @@ After this, you have to prepare CRUDs with ready-to-use endpoints:
42
48
## Configuration params
43
49
44
50
The following interface is using for the configuration:
51
+
45
52
```typescript
46
-
exportinterfaceModuleOptions {
47
-
entities:Entity[]; // List of typeOrm Entity
48
-
controllers?:NestController[]; // List of controller, if you need extend default present
49
-
connectionName?:string; // Type orm connection name: "default" is default name
50
-
providers?:NestProvider[]; // List of addition provider for useing in custom controller
51
-
imports?:NestImport[]; // List of addition module for useing in custom controller
52
-
options?: {
53
-
requiredSelectField?:boolean; // Need list of select field in get endpoint, try is default
54
-
debug?:boolean; // Debug info in result object
53
+
exportinterfaceModuleOptions {
54
+
entities:Entity[]; // List of typeOrm Entity
55
+
controllers?:NestController[]; // List of controller, if you need extend default present
56
+
connectionName?:string; // Type orm connection name: "default" is default name
57
+
providers?:NestProvider[]; // List of addition provider for useing in custom controller
58
+
imports?:NestImport[]; // List of addition module for useing in custom controller
59
+
options?: {
60
+
requiredSelectField?:boolean; // Need list of select field in get endpoint, try is default
61
+
debug?:boolean; // Debug info in result object
55
62
pipeForId?:Type<PipeTransform> // Nestjs pipe for validate id params, by default ParseIntPipe
0 commit comments