Skip to content

Commit eb3411f

Browse files
committed
README
1 parent 4deafd4 commit eb3411f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ These are all the configuration options and their default value between brackets
5757
- "username": Username of the user connecting to the database (no default)
5858
- "password": Password of the user connecting to the database (no default)
5959
- "database": Database the connecting is made to (no default)
60+
- "mapping": Comma separated list of table/column mappings (no mappping)
6061
- "tables": Comma separated list of tables to publish (defaults to 'all')
6162
- "middlewares": List of middlewares to load (`cors`)
6263
- "controllers": List of controllers to load (`records,geojson,openapi,status`)
@@ -112,6 +113,7 @@ The following features are supported:
112113
- Atomic increment support via PATCH (for counters)
113114
- Binary fields supported with base64 encoding
114115
- Spatial/GIS fields and filters supported with WKT and GeoJSON
116+
- Mapping table and column names to support legacy systems
115117
- Generate API documentation using OpenAPI tools
116118
- Authentication via API key, JWT token or username/password
117119
- Database connection parameters may depend on authentication
@@ -624,6 +626,17 @@ The following Geometry types are supported by the GeoJSON implementation:
624626

625627
The GeoJSON functionality is enabled by default, but can be disabled using the "controllers" configuration.
626628

629+
## Mapping names for legacy systems
630+
631+
To support creating an API for (a part of) a legacy system (such as Wordpress) you may want to map the table and column names as you
632+
may not be able to alter them without breaking the software. The config allows you to rename tables and columns with a
633+
comma separated list of mappings that are split with an equal sign, like this:
634+
635+
'mapping' => 'wp_posts=posts,wp_posts.ID=posts.id',
636+
637+
This specific example will expose the "wp_posts" table as "posts" and the field "ID" within that table as "id" (notice
638+
the casing).
639+
627640
## Middleware
628641

629642
You can enable the following middleware using the "middlewares" config parameter:

0 commit comments

Comments
 (0)