編輯AoR的製作者:您的框架遭受可怕的文檔。你應該真的專注於此,人們會真的採用它。如何使用couchDB設置admin-on-rest?
我不能爲我的生活解密如何管理休息做'休息'的一部分。如果有更好的文檔更好的框架,我願意接受。
我很新的反應,所以這可能是其中的一部分。
我可以辨別是
1)[管理員]標籤需要道具「RESTClient實現」,這是設置爲你的JSON源的基本路徑的功能,然後返回一個特定的功能簽名(需要3個參數,返回一個承諾)。
2)然後,[資源]標籤增加了與NAME =「上崗」的路徑,使一個列表,其中(繼承人它變成魔法)基本上沒有一個wget來你的數據庫,然後對結果進行迭代。
我想要做的事:將couchDB連接到admin-on-rest。我已經在本地主機上製作了一些測試文檔。 CouchDB的URL看起來像:
http://127.0.0.1:5984/myproject/_design/getclients/_view/getclient/
和這部作品在郵遞員,給我一個JSON對象是這樣的:
{
"total_rows": 4,
"offset": 0,
"rows": [
{
"id": "afc3bb9218d1a5c1e81ab3cc9f004467",
"key": {
"status": "active",
"rating": 9.1,
"bio": {
"fname": "Sam",
"mname": "TestMName",
"lname": "TestLName",
"address": "712347 B Street",
"state": "CA",
"city": "Los Santos",
"zip": "90211",
"phone": "123-456-7890",
"email": "[email protected]",
"username": "TestSam",
"password": "abc123"
}
},
"value": null
},
在這一點上我好迷茫,我不知道去哪裏找。
繼承人我現在代碼:
//App.js
import React from 'react';
import { jsonServerRestClient, Admin, Resource } from 'admin-on-rest';
import { PostList } from './Posts.js';
const App =() => (
<Admin restClient={jsonServerRestClient('http://127.0.0.1:5984/myproject/')}>
<Resource name="_design/getclients/_view/getclient" list={PostList} />
</Admin>
);
export default App;
而且
//Posts.js
export const PostList = (props) => (
<List {...props}>
<Datagrid>
<TextField source="status" />
<TextField source="rating" />
</Datagrid>
</List>
);
該頁面加載,但粉紅色的小盒子底部彈出說:
The X-Total-Count header is missing in the HTTP Response. The jsonServer REST client expects responses