一覧へ戻る
tomberek/aor-postgrest-client(新しいタブで開きます)
主要言語: JavaScript
postREST client for admin-on-rest
- star 数
- 77
- watcher 数
- 7
- fork 数
- 33
- issue 数
- 4
- 最終更新
- 2021/03/24
主要言語: JavaScript
postREST client for admin-on-rest
For using postgREST with admin-on-rest, use the postgrestClient function to convert AOR's REST dialect into one compatible with postgREST.
npm install aor-postgrest-client --save
See the example in App.js.example
// in src/App.js import React from 'react'; import { Admin, Resource } from 'react-admin'; import postgrestClient from 'aor-postgrest-client'; import { List, Datagrid, TextField, NumberField } from 'react-admin'; import { ShowButton, EditButton, Edit, SimpleForm, DisabledInput, TextInput, NumberInput } from 'react-admin'; import { Create} from 'react-admin'; import { Show, SimpleShowLayout } from 'react-admin'; const BookList = (props) => ( <List {...props}> <Datagrid> <ShowButton /> <EditButton /> <TextField source="author" /> <NumberField source="count" /> </Datagrid> </List> ); export const BookShow = (props) => ( <Show {...props}> <SimpleShowLayout> <TextField source="author" /> <NumberField source="count" /> </SimpleShowLayout> </Show> ); export const BookEdit = (props) => ( <Edit {...props}> <SimpleForm> <DisabledInput source="id" /> <TextInput source="author" /> <NumberInput source="count" /> </SimpleForm> </Edit> ); export const BookCreate = (props) => ( <Create {...props}> <SimpleForm> <TextInput source="author" /> <NumberInput source="count" /> </SimpleForm> </Create> ); const App = () => ( <Admin dataProvider={postgrestClient('http://localhost:3000')}> <Resource name="books" show={BookShow} create={BookCreate} edit={BookEdit} list={BookList} /> </Admin> ); export default App;
This library is licensed under the MIT Licence, and sponsored by tomberek.