Expose a HAFAS client (e.g., for Deutsche Bahn, SBB, etc.) via an HTTP REST API. v5.1.3. Works as a middleware for Express or Node http modules, enabling integration of public transport timetable data into web apps. Key differentiator: wraps the hafas-client library into a standardized REST interface, supporting multiple HAFAS endpoints with a unified configuration approach.
npm install hafas-rest-apiNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a HAFAS REST API server using the default export from hafas-rest-api with an Express-compatible handler.
Convert project to ESM (type: "module" in package.json) and use import syntax.
Update hafas-client to version 6 in your dependencies.
Use the path option to set a base path, e.g., { path: '/api' }.Set rateLimit option during API creation.
Change to import statement: import createApi from 'hafas-rest-api';
Use default import: import createApi from 'hafas-rest-api';
Install hafas-client: npm install hafas-client