aor-postgrest-client

postREST client for admin-on-rest

  • Owner: tomberek/aor-postgrest-client
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

postgREST 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.

Installation

npm install aor-postgrest-client --save

Usage

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;

License

This library is licensed under the MIT Licence, and sponsored by tomberek.

Main metrics

Overview
Name With Ownertomberek/aor-postgrest-client
Primary LanguageJavaScript
Program languageMakefile (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2017-02-04 07:57:46
Pushed At2021-03-24 13:11:11
Last Commit At2020-03-29 13:58:33
Release Count0
用户参与
Stargazers Count79
Watchers Count9
Fork Count33
Commits Count35
Has Issues Enabled
Issues Count10
Issue Open Count4
Pull Requests Count5
Pull Requests Open Count0
Pull Requests Close Count6
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private