@@ -7,16 +7,16 @@ Installation: `yarn add @admin-bro/typeorm`
77## Usage
88
99The plugin can be registered using standard ` AdminBro.registerAdapter ` method.
10-
10+ o
1111``` typescript
12- import { Database , Resource } from " @admin-bro/typeorm" ;
12+ import { Database , Resource } from ' @admin-bro/typeorm'
1313import AdminBro from ' admin-bro'
1414
1515AdminBro .registerAdapter ({ Database , Resource });
1616
1717// optional: if you use class-validator you have to inject this to resource.
1818import { validate } from ' class-validator'
19- Resource .validate = validate ;
19+ Resource .validate = validate
2020```
2121
2222## Example
@@ -28,16 +28,16 @@ import {
2828 createConnection ,
2929 ManyToOne ,
3030 RelationId
31- } from ' typeorm' ;
32- import * as express from ' express' ;
33- import { Database , Resource } from ' @admin-bro/typeorm' ;
31+ } from ' typeorm'
32+ import * as express from ' express'
33+ import { Database , Resource } from ' @admin-bro/typeorm'
3434import { validate } from ' class-validator'
3535
36- import AdminBro from ' admin-bro' ;
36+ import AdminBro from ' admin-bro'
3737import * as AdminBroExpress from ' @admin-bro/express'
3838
39- Resource .validate = validate ;
40- AdminBro .registerAdapter ({ Database , Resource });
39+ Resource .validate = validate
40+ AdminBro .registerAdapter ({ Database , Resource })
4141
4242@Entity ()
4343export class Person extends BaseEntity
@@ -67,24 +67,24 @@ export class Person extends BaseEntity
6767
6868( async () =>
6969{
70- const connection = await createConnection ({/* ... */ });
70+ const connection = await createConnection ({/* ... */ })
7171
7272 // Applying connection to model
73- Person .useConnection (connection );
73+ Person .useConnection (connection )
7474
7575 const adminBro = new AdminBro ({
7676 // databases: [connection],
7777 resources: [
7878 { resource: Person , options: { parent: { name: ' foobar' } } }
7979 ],
8080 rootPath: ' /admin' ,
81- });
81+ })
8282
83- const app = express ();
84- const router = AdminBroExpress .buildRouter (adminBro );
85- app .use (adminBro .options .rootPath , router );
86- app .listen (3000 );
87- })();
83+ const app = express ()
84+ const router = AdminBroExpress .buildRouter (adminBro )
85+ app .use (adminBro .options .rootPath , router )
86+ app .listen (3000 )
87+ })()
8888```
8989
9090## ManyToOne
@@ -124,9 +124,18 @@ Optionally you might want to link your local version of `admin-bro` package
124124
1251255 . Make sure you have all the envs set (which are defined in ` example-app/ormconfig.js ` )
126126
127+ 6 . Build the package in watch mode
128+
129+ (in the root folder)
130+
131+ ```
132+ yarn watch
133+ ```
134+
1271356 . run the app in the dev mode
128136
129137```
138+ cd example-app
130139yarn start:dev
131140```
132141
0 commit comments