_____ _____ ___
\_ \ /__ \ / __\___ _ __ _ __ ___
/ /\/ / /\/ / / / _ \| '__| '_ \ / _ \
/\/ /_ / / / /__| (_) | | | |_) | (_) |
\____/ \/ \____/\___/|_| | .__/ \___/
|_|
npm install
npm start
# OR
npm start -- -p <PORT> -t true -d <baseDelay>
npm start -- -p 3010 -t true -d 3000
# localhost:3010, tenant: required, delay: 3000 miliseconds
/employees
->Employee[]
/employees/count
->number
/employees?_page=1
->Employee[]
/employees?_limit=10&_page=2
->Employee[]
/employees?name_like=Fri
->Employee[]
/employees?firstName_like=Fr
->Employee[]
-
p
/port
(number) - well... the port -
d
/delay
(number, milliseconds) - determines minimum delay. Some random length delay will take place additionally. -
f
/fail
(number from range 0..1) - probability of random fails on processing requests. Useful for testing error handling, optimistic updates, etc. Defaults to0
(no random fails). Iffu
not set, all requests are considered to randomly fail. -
failUrls
- (comma-separated string, list of URL patterns) - iff
option is on, the requests that match any of the URL pattern in this list might potentially fail. Useful when you want to choose certain resources to be unstable temporarily. Example:-fu employees,offices
-employees*
andoffices*
are unstable, rest is stable -
t
/tenantRequired
(boolean) - determines whether theTenantID
header will be required for most resources (see Tenants). By default, this API is more permissive (header not required). -
jwtAuth
- (boolean) - determines whether JWT authentication is required or not, default: false
http://localhost:3000/employees?name_like=Fri
(searching byfirstName
andlastName
only, instead of?q=___
for full-text search on all properties)
See mw/employee_name.js
file.
- see
json-server
docs for standard commands - this API also supports each collection command
...count
subresource - this API limits all page sizes to 50 (unless you specify a smaller page size)
- example calls:
- /employees
- /employees/count
- /employees?skills_like=html
- /employees/count?skills_like=html
- license (requires
Accept
to betext/plain
) - benefits
- departments
- employees
- geo
- offices
- projects
When t
is on, most resources require the TenantID
header to be set. Just set this header value to E2B31329-8818-428A-90DC-8F065318C052
.