-
Notifications
You must be signed in to change notification settings - Fork 3
/
scully.warehouse.config.ts
52 lines (50 loc) · 1.62 KB
/
scully.warehouse.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { ScullyConfig } from '@scullyio/scully'
/** this loads the default render plugin, remove when switching to something else. */
import '@scullyio/scully-plugin-puppeteer'
export const config: ScullyConfig = {
projectRoot: './src',
projectName: 'warehouse',
outDir: './dist/static',
routes: {
'/articles/:id': {
type: 'json',
id: {
url: 'http://localhost:9999/api/articles',
property: 'id',
/**
* resultsHandler: (response: any) => any[]
*
* If the `url` returns an object, use the `resultsHandler` to map that object
* into an array of objects/ids.
*
* In the following example, the server returned an object where the articles were
* nested inside of the `response.data` property. So the resultsHandler returns
* `response.data.articles`.
*/
resultsHandler: (response) => {
return response.docs
},
},
},
'/articles/:id/edit': {
type: 'json',
id: {
url: 'http://localhost:9999/api/articles',
property: 'id',
/**
* resultsHandler: (response: any) => any[]
*
* If the `url` returns an object, use the `resultsHandler` to map that object
* into an array of objects/ids.
*
* In the following example, the server returned an object where the articles were
* nested inside of the `response.data` property. So the resultsHandler returns
* `response.data.articles`.
*/
resultsHandler: (response) => {
return response.docs
},
},
},
},
}