You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Model-driven REST API for CRUD and more, using Node.js, Express, and PostgreSQL.
5
4
6
5
Evolutility-Server-Node provides a set of generic [REST APIs](#API) for CRUD (Create, Read, Update, Delete) and simple charts. on objects of different structures.
@@ -9,8 +8,8 @@ Evolutility-Server-Node provides a set of generic [REST APIs](#API) for CRUD (Cr
9
8
10
9
For a matching model-driven Web UI, use [Evolutility-UI-React](http://github.com/evoluteur/evolutility-ui-react) or [Evolutility-UI-jQuery](http://evoluteur.github.io/evolutility-ui-jquery/).
11
10
11
+
## Table of Contents
12
12
13
-
### Table of Contents
14
13
1.[Installation](#Installation)
15
14
2.[Setup](#Setup)
16
15
3.[Configuration](#Configuration)
@@ -27,6 +26,7 @@ For a matching model-driven Web UI, use [Evolutility-UI-React](http://github.com
27
26
# To get the latest stable version, use git from the command line.
| apiPath | Path for REST API (i.e.: "/api/v1/"). |
93
+
|apiPort| Port for REST API (i.e.: 2000). |
94
+
|connectionString | DB connection string (i.e.: "postgres://evol:love@localhost:5432/evol"). |
95
+
|schema | DB schema name (i.e.: "evolutility").|
96
+
|pageSize| Number of rows per page in pagination (default = 50).|
97
+
|lovSize| Maximum number of values allowed for form dropdowns (default = 100). |
98
+
|csvSize| Maximum number of rows in CSV export (default = 1000).|
99
+
|csvHeader| CSV list of labels for CSV export|
100
+
|uploadPath| path for pictures and documents uploads (i.e.: "../evolutility-ui-react/public/pix/").|
101
+
| logToConsole | Log SQL and errors to console.|
102
+
| logToFile | Log SQL and errors to a file. Log files are named like "evol-2019-09-15.log". |
103
+
| wComments | Allow for user comments (not implemented yet). |
104
+
| wRating | Allow for user ratings (not implemented yet). |
105
+
| wTimestamp | Timestamp columns w/ date of record creation and last update. |
107
106
| createdDateColumn | Column containing created date (default "created_at"). |
108
107
| updatedDateColumn | Column containing last update date (default "updated_at"). |
109
-
| schemaQueries | Enables endpoints to query for lists of tables and columns in the database schema. |
108
+
| schemaQueries | Enables endpoints to query for lists of tables and columns in the database schema. |
110
109
111
110
<aname="Models"></a>
112
111
## Models
@@ -119,7 +118,6 @@ Models contain the name of the driving table and the list of fields/columns pres
119
118
-[Collection](#Collection)
120
119
-[Sample model](#SampleModel)
121
120
122
-
123
121
<aname="Object"></a>
124
122
### Object
125
123
@@ -156,7 +154,6 @@ Models contain the name of the driving table and the list of fields/columns pres
156
154
| noStats | Exclude field from Stats. |
157
155
| deleteTrigger | Deleting records in the lovTable will trigger a cascade delete (this property is only used while creating the database). |
158
156
159
-
160
157
<aname="Collection"></a>
161
158
### Collection
162
159
@@ -173,7 +170,6 @@ Multiple Master-Details can be specified with collections.
173
170
174
171
Example of collection in [Wine cellar](https://github.com/evoluteur/evolutility-server-node/blob/master/models/organizer/winecellar.js).
175
172
176
-
177
173
<aname="SampleModel"></a>
178
174
### Sample model
179
175
@@ -240,6 +236,7 @@ More information about Evolutility models and some useful scripts are available
240
236
241
237
<aname="API"></a>
242
238
## REST API
239
+
243
240
Evolutility-Server-Node provides a generic RESTful API for CRUD (Create, Read, Update, Delete) and more. It is inspired from [PostgREST](http://postgrest.com).
244
241
245
242
-[Get](#API_Get)
@@ -254,6 +251,7 @@ When running Evolutility-Server-Node locally, the base url is
254
251
### Requesting Information
255
252
256
253
#### Get One
254
+
257
255
Gets a specific record by ID.
258
256
259
257
```
@@ -271,6 +269,7 @@ GET /todo/12?shallow=1
271
269
```
272
270
273
271
#### Get Many
272
+
274
273
Gets a list of records.
275
274
276
275
```
@@ -279,9 +278,9 @@ GET /{model.id}
279
278
GET /todo
280
279
```
281
280
282
-
283
281
<aname="Filtering"></a>
284
282
#### Filtering
283
+
285
284
You can filter result rows by adding conditions on fields, each condition is a query string parameter.
286
285
287
286
```
@@ -314,7 +313,6 @@ For each field a sub-set of the operators below will be supported by the API (de
314
313
| null | is null | /todo?category=null |
315
314
| nn | is not null | /todo?category==nn |
316
315
317
-
318
316
#### Searching
319
317
320
318
You can search for a specific string across multiple fields at once with the "search" parameter. The list of fields to be searched is specified with "searchFields" in the model (if unspecified, text fields flagged with "inMany" for list view will be used).
@@ -359,6 +357,7 @@ GET /{model.id}?format=csv
359
357
360
358
GET /todo?format=csv
361
359
```
360
+
362
361
Notes: In the returned data every object has an extra property "\_full_count" which indicate the total number of records in the query (before limit).
363
362
364
363
<aname="API_Update"></a>
@@ -397,8 +396,8 @@ PUT /todo/5
397
396
398
397
Notes: The request returns the updated record. It is not standard but it saves the UI a subsequent call.
399
398
400
-
401
399
#### Deletion
400
+
402
401
Simply use the DELETE verb with the id of the record to remove.
403
402
404
403
```
@@ -484,7 +483,6 @@ POST /comics/upload/5
484
483
485
484
With query parameters: file and "field.id".
486
485
487
-
488
486
#### Nested collections
489
487
490
488
If the model has collections defined, they can be queried with this end-point.
0 commit comments