Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic path pages #119

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Here's a detailed list of properties you could add to your configuration file (j
| Property | Type | Required? | Description |
|----------------|--------------|-----|----------------------------------------------------------------|
| name | `string` | true | The name of your app.|
| pages | `array` | true | A list of pages in your app, each page will be presented as a separated tab, and will have his own methods and properties. |
| resources | `array` | true | A list of resources in your app, each resource will be presented as a separated tab, and will have his own methods and properties. |
| baseUrl | `string` | false | Base url of the api. This will prefix the url of all the api methods defined for all pages. This is normally the domain plus a base path. For example: `"https://restool-sample-app.herokuapp.com/api"` <br /><br /> Note: If different pages use different base urls this should not be used. Instead, you should explicitly define absolute urls for each method. |
| requestHeaders | `object` | false | A list of key-value headers you wish to add to every request we're making. <br /><br /> For example: <br />``{ Authentication: 'SECRET_KEY', 'X-USER-ID': 'USER_ID' }``. |
| errorMessageDataPath | `string[]` | false | The path within an error response object to look for an error message. If multiple are provided, each will be tried in order until a message is found. |
Expand All @@ -81,17 +81,18 @@ export default {
```
<br />

### Pages
### Resources

Each **page** is an object and represents a resource in your API. It should have the following properties:
Each **resource** is an object and represents a resource in your API. It should have the following properties:

| Property | Type | Required? | Description |
|----------------|--------------|-----|----------------------------------------------------------------|
| name | `string` | true | The name of the page. This will be presented in the menu.|
| id | `string` | true | A unique identifier for the page. RESTool will use it to navigate between pages. |
| name | `string` | true | The name of the resource. This will be presented in the menu. |
| id | `string` | true | A unique identifier for the resource. RESTool will use it to navigate between resources. |
| description | `string` | false | A short description about the page and its usage. |
| requestHeaders | `object` | false | A list of key-value headers you wish to add to every request we're making. <br /><br /> For example: <br />``{ Authentication: 'SECRET_KEY', 'X-USER-ID': 'USER_ID' }``. |
| methods | `object` | true | A list of all methods which are available in your RESTful API. |
| subResources | `array` | false | A list of all sub-resources available in your RESTful API. See [sub-resources](#sub-resources) |
| customActions | `object[]` | false | A list of extra (non RESTful) endpoints available in your RESTful API. Specifically `customActions` is a list of PUT or POST method objects. <br /><br />Read more about custom actions [here](#custom-actions). |
| customLabels | `object` | false | [Custom labels](#custom-labels) |

Expand Down Expand Up @@ -216,6 +217,8 @@ An example of a `getSingle` request:
}
```

This method will also be used for a "Details" action if the `"id"` is provided to give the resource detail page an id. It will redirect you to an item detail page where its [sub-resources](#sub-resources) will be shown in tabs if any are defined within the resource. It will use the `"fields"` field to display the item or use the one defined in the `getAll` method if not provided.

<br />

##### `post`
Expand Down Expand Up @@ -301,7 +304,7 @@ Example:

#### Pagination

The `pagination` property allows you to handle pagination on .
The `pagination` property allows you to handle pagination on resources `getAll` method.

Here's a list of variable names you may change:

Expand Down Expand Up @@ -333,6 +336,14 @@ The `fields` field has the following properties that all can be defined with a `

<br />

#### Sub-resources

The `subResources` property allows you to expose sub-resources that are "under" its parent resource. For example, `classrooms/:id/students` would be a sub-resource path of your API.

Its configuration is the same than a [resource](#resources) one.

<br />

#### Custom Actions

A list of extra (non RESTful) endpoints available in your RESTful API. Specifically `customActions` is a list of PUT or POST method objects. For example this could enable an endpoint like: ``PUT /users/:id/disable``
Expand Down
22 changes: 11 additions & 11 deletions build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"files": {
"main.css": "./static/css/main.4cc0f9aa.chunk.css",
"main.js": "./static/js/main.93cb13b6.chunk.js",
"main.js.map": "./static/js/main.93cb13b6.chunk.js.map",
"main.css": "./static/css/main.55118344.chunk.css",
"main.js": "./static/js/main.7c2aa508.chunk.js",
"main.js.map": "./static/js/main.7c2aa508.chunk.js.map",
"runtime-main.js": "./static/js/runtime-main.f1c188a0.js",
"runtime-main.js.map": "./static/js/runtime-main.f1c188a0.js.map",
"static/css/2.5dbdccff.chunk.css": "./static/css/2.5dbdccff.chunk.css",
"static/js/2.7c8c2e97.chunk.js": "./static/js/2.7c8c2e97.chunk.js",
"static/js/2.7c8c2e97.chunk.js.map": "./static/js/2.7c8c2e97.chunk.js.map",
"static/js/2.d8b89a53.chunk.js": "./static/js/2.d8b89a53.chunk.js",
"static/js/2.d8b89a53.chunk.js.map": "./static/js/2.d8b89a53.chunk.js.map",
"index.html": "./index.html",
"precache-manifest.eaa825d1bfa330ea42de3a1a5b11ded2.js": "./precache-manifest.eaa825d1bfa330ea42de3a1a5b11ded2.js",
"precache-manifest.0d2855ff8de0b0b2beaa023b1afcf181.js": "./precache-manifest.0d2855ff8de0b0b2beaa023b1afcf181.js",
"service-worker.js": "./service-worker.js",
"static/css/2.5dbdccff.chunk.css.map": "./static/css/2.5dbdccff.chunk.css.map",
"static/css/main.4cc0f9aa.chunk.css.map": "./static/css/main.4cc0f9aa.chunk.css.map",
"static/js/2.7c8c2e97.chunk.js.LICENSE": "./static/js/2.7c8c2e97.chunk.js.LICENSE"
"static/css/main.55118344.chunk.css.map": "./static/css/main.55118344.chunk.css.map",
"static/js/2.d8b89a53.chunk.js.LICENSE": "./static/js/2.d8b89a53.chunk.js.LICENSE"
},
"entrypoints": [
"static/js/runtime-main.f1c188a0.js",
"static/css/2.5dbdccff.chunk.css",
"static/js/2.7c8c2e97.chunk.js",
"static/css/main.4cc0f9aa.chunk.css",
"static/js/main.93cb13b6.chunk.js"
"static/js/2.d8b89a53.chunk.js",
"static/css/main.55118344.chunk.css",
"static/js/main.7c2aa508.chunk.js"
]
}
2 changes: 1 addition & 1 deletion build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="manifest" href="./manifest.json"/><title>RESTool App</title><link href="./static/css/2.5dbdccff.chunk.css" rel="stylesheet"><link href="./static/css/main.4cc0f9aa.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(i){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],l=0,f=[];l<n.length;l++)t=n[l],Object.prototype.hasOwnProperty.call(p,t)&&p[t]&&f.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(i[r]=o[r]);for(s&&s(e);f.length;)f.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=l(l.s=t[0]))}return e}var t={},p={1:0},c=[];function l(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return i[e].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.m=i,l.c=t,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(r,e){if(1&e&&(r=l(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)l.d(t,n,function(e){return r[e]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="./";var r=this.webpackJsonprestool=this.webpackJsonprestool||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="./static/js/2.7c8c2e97.chunk.js"></script><script src="./static/js/main.93cb13b6.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="manifest" href="./manifest.json"/><title>RESTool App</title><link href="./static/css/2.5dbdccff.chunk.css" rel="stylesheet"><link href="./static/css/main.55118344.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(i){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],l=0,f=[];l<n.length;l++)t=n[l],Object.prototype.hasOwnProperty.call(p,t)&&p[t]&&f.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(i[r]=o[r]);for(s&&s(e);f.length;)f.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=l(l.s=t[0]))}return e}var t={},p={1:0},c=[];function l(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return i[e].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.m=i,l.c=t,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(r,e){if(1&e&&(r=l(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)l.d(t,n,function(e){return r[e]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="./";var r=this.webpackJsonprestool=this.webpackJsonprestool||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="./static/js/2.d8b89a53.chunk.js"></script><script src="./static/js/main.7c2aa508.chunk.js"></script></body></html>
30 changes: 30 additions & 0 deletions build/precache-manifest.0d2855ff8de0b0b2beaa023b1afcf181.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "5c33b5fa029d2ee9c99d6dd6636414a3",
"url": "./index.html"
},
{
"revision": "bb19f1efb7840db65c62",
"url": "./static/css/2.5dbdccff.chunk.css"
},
{
"revision": "86a913034fa0411483f1",
"url": "./static/css/main.55118344.chunk.css"
},
{
"revision": "bb19f1efb7840db65c62",
"url": "./static/js/2.d8b89a53.chunk.js"
},
{
"revision": "6ceee2230a275e6f350d0faebed10188",
"url": "./static/js/2.d8b89a53.chunk.js.LICENSE"
},
{
"revision": "86a913034fa0411483f1",
"url": "./static/js/main.7c2aa508.chunk.js"
},
{
"revision": "58d6219fe1f60f2fa5af",
"url": "./static/js/runtime-main.f1c188a0.js"
}
]);
30 changes: 0 additions & 30 deletions build/precache-manifest.eaa825d1bfa330ea42de3a1a5b11ded2.js

This file was deleted.

4 changes: 2 additions & 2 deletions build/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");

importScripts(
"./precache-manifest.eaa825d1bfa330ea42de3a1a5b11ded2.js"
"./precache-manifest.0d2855ff8de0b0b2beaa023b1afcf181.js"
);

self.addEventListener('message', (event) => {
Expand All @@ -35,5 +35,5 @@ workbox.precaching.precacheAndRoute(self.__precacheManifest, {});

workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("./index.html"), {

blacklist: [/^\/_/,/\/[^/?]+\.[^/]+$/],
blacklist: [/^\/_/,/\/[^\/?]+\.[^\/]+$/],
});
1 change: 0 additions & 1 deletion build/static/css/main.4cc0f9aa.chunk.css.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build/static/css/main.55118344.chunk.css.map

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions build/static/js/2.7c8c2e97.chunk.js

This file was deleted.

1 change: 0 additions & 1 deletion build/static/js/2.7c8c2e97.chunk.js.map

This file was deleted.

3 changes: 3 additions & 0 deletions build/static/js/2.d8b89a53.chunk.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build/static/js/2.d8b89a53.chunk.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions build/static/js/main.7c2aa508.chunk.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build/static/js/main.7c2aa508.chunk.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions build/static/js/main.93cb13b6.chunk.js

This file was deleted.

1 change: 0 additions & 1 deletion build/static/js/main.93cb13b6.chunk.js.map

This file was deleted.

Loading