1.0.0 • Published 3 years ago

dynamic-rest-middleware v1.0.0

Weekly downloads
35
License
MIT
Repository
github
Last release
3 years ago

Dynamic rest middleware (for Django on server side)

This is a library for generating a valid django dynamic rest request:

  • URL
  • Filters
  • Modificators
  • Include
  • Exclude
  • Sort
  • Page size
  • Page

How to install

yarn add dynamic-rest-middlewar
npm i dynamic-rest-middlewar

How to use

Library export function getUrl you should pass params

Params

NameTypeDiscriptionExample
urlstringUrl to some entityusers
filtersarray of FilterArray of Filters { name: 'name', value: 'John', mod: 'icontains' }
includearray of stringArray of includes 'songs.*', 'genre' }
excludearray of stringArray of excludes 'favorite.*', 'likes' }
sortarray of SortArray of Sort { field: 'views', not: true }
excludeAllbooleanExclude all fields trought add exclude[]=*.*true
pageSizenumberSpecify the number of records on page120
pagenumberSpecify the number of page2

Filters

NameTypeDiscriptionExample
fieldstringField of filterlikes
valuestringValue of field24
modstringModificator of filtering (icontains, in...)startswith
notbooleanReverse lookuptrue

Sort

NameTypeDiscriptionExample
fieldstringField of sortid
notbooleanReverse sortingtrue
I would be extremely happy to receive feedback, comments and other ways to improve the library and documentation :з

GitHub

1.0.0

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago