This repository was archived by the owner on Jun 22, 2021. It is now read-only.
File tree 6 files changed +8
-62
lines changed
6 files changed +8
-62
lines changed Original file line number Diff line number Diff line change 30
30
- run :
31
31
name : Compiling Code
32
32
command : npm run build
33
- - run :
34
- name : Running tests
35
- command : npm run cover
36
33
- run :
37
34
name : Linting Code
38
35
command : npm run lint
Original file line number Diff line number Diff line change 5
5
1 . Install it with ` npm i @js-entity-repos/axios ` .
6
6
1 . For each entity you will need to do the following.
7
7
1 . [ Create an Entity interface] ( #entity-interface ) .
8
- 1 . [ Create a factory config] ( #factory-config ) .
9
8
1 . [ Construct the facade] ( #construct-the-facade ) .
10
9
1 . [ Use the facade] ( https://github.com/js-entity-repos/core/blob/master/docs/facade.md ) .
11
10
@@ -22,13 +21,13 @@ export interface TodoEntity extends Entity {
22
21
}
23
22
```
24
23
25
- ### Factory Config
24
+ ### Construct the Facade
26
25
27
26
``` ts
28
- import FactoryConfig from ' @js-entity-repos/axios/dist/FactoryConfig ' ;
27
+ import factory from ' @js-entity-repos/axios/dist/factory ' ;
29
28
import axios from ' axios' ;
30
29
31
- const todoFactoryConfig : FactoryConfig <TodoEntity > = {
30
+ const todosFacade = factory <TodoEntity >( {
32
31
axios: axios .create ({
33
32
baseURL: ` http://localhost:80/api/todos ` ,
34
33
}),
@@ -50,13 +49,5 @@ const todoFactoryConfig: FactoryConfig<TodoEntity> = {
50
49
},
51
50
defaultPaginationLimit: 100 , // Optional property.
52
51
entityName: ' todo' ,
53
- };
54
- ```
55
-
56
- ### Construct the Facade
57
-
58
- ``` ts
59
- import factory from ' @js-entity-repos/axios/dist/factory' ;
60
-
61
- const todosFacade = factory (todoFactoryConfig );
52
+ });
62
53
```
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ sourceMapSupport.install();
3
3
4
4
import facadeTest from '@js-entity-repos/core/dist/tests' ;
5
5
import { TestEntity } from '@js-entity-repos/core/dist/tests/utils/testEntity' ;
6
+ import createTestServer from '@js-entity-repos/express/dist/utils/createTestServer' ;
6
7
import axios from 'axios' ;
7
8
import { config } from 'dotenv' ;
8
9
import 'mocha' ; // tslint:disable-line:no-import-side-effect
9
10
import factory from './factory' ;
10
- import createTestServer from './utils/createTestServer' ;
11
11
config ( ) ;
12
12
13
13
const defaultServerPort = 1337 ;
Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ export default <E extends Entity>(config: FacadeConfig<E>): GetEntities<E> => {
22
22
} ;
23
23
const response = await Promise . resolve ( config . axios . get ( '' , { params } ) ) ;
24
24
25
- const entities = response . data . entities . map ( config . constructEntity ) ;
26
- const nextCursor = response . data . nextCursor ;
27
- const previousCursor = response . data . previousCursor ;
25
+ const entities = response . data . map ( config . constructEntity ) ;
26
+ const nextCursor = response . headers [ 'x-entities-next-cursor' ] ;
27
+ const previousCursor = response . headers [ 'x-entities-previous-cursor' ] ;
28
28
29
29
return { entities, nextCursor, previousCursor } ;
30
30
} ;
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments