Middleware for Express to auto-generate REST APIs from SQL queries against GeoEngineDS (a geo-spatial data service). Version 3.8.9 requires Node >= 8.9.0 and uses ESM imports. Supports dynamic SQL assembly with query parameterization for injection prevention, multiple output formats (origin, GeoJSON), and lifecycle hooks (beforeSend, afterSend, onError). Differentiator: maps data source IDs to SQL endpoints declaratively with built-in SQL injection protection using context.format.
npm install ganjiang-middlewareNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up an Express app with GeoEngineDS middleware to auto-generate an API endpoint /api/data that executes a SQL query.
Use context.format(sql, params) to safely parameterize queries.
Ensure app.use(bodyParser...) comes before app.use(GeoEngineDS(...)).
Provide both dsMap (object with ds name to id mapping) and apiList (array of route definitions).
Upgrade Node.js to >=8.9.0.
Install using 'npm install ganjiang-middleware' then import from 'ganjiang-middleware'.
Use import GeoEngineDS from 'GeoEngineDS' in ESM module.
Ensure config.dsMap is defined as an object with string keys and numeric values.