JSPM

ra-data-spring-rest

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q37565F
  • License ISC

Maps react-admin queries to a REST API implemented using Spring Rest

Package Exports

  • ra-data-spring-rest

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ra-data-spring-rest) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

= ra-data-spring-rest xiayx xiayouxue@hotmail.com v1.0, 2020-03-18: SNAPSHOT

A https://github.com/marmelab/react-admin[React-admin] data provider for backends built with Spring Framework.

== Installation

npm install --save ra-data-spring-rest

== Usage

[source%nowrap,javascript]

// in App.js import React from 'react'; import { Admin, Resource } from 'react-admin'; import {springDataProvider, springHttpClient} from 'ra-data-spring-rest'; import { UserList } from './users';

const dataProvider = springDataProvider('http://path.to.api/',springHttpClient()); const App = () => ( );

export default App;

springHttpClient() use fetch to send request, + you can also use springHttpClient(fetchUtils.fetchJson), + or customize it:

[source%nowrap,javascript]

let httpClient = (url, options = {}) => { options.credentials = 'include'; return springHttpClient(url, options, fetchUtils.fetchJson) .then(response => { // do some thing you want return response; }); };

== Feature

This package was built to work with the default configurations of a web app using Spring Framework. It currently supports:

  • Spring URLs with path variable.
  • Sorting with SortHandlerMethodArgumentResolver, using the sort query string parameter.
  • Pagination with PageableHandlerMethodArgumentResolver, using the page and size query string parameters.

the react-admin Data Provider request example: