A lightweight TypeScript library for building REST URLs with easy parameter substitution, query string handling, and base URL support. Version 1.0.6 is the latest stable release with no breaking changes in the v1.x series. Differentiates from other URL builders by focusing specifically on RESTful patterns with typed parameter placeholders and automatic encoding. Suitable for both browser and Node.js environments.
npm install rest-url-builderNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a REST URL with path parameters and query string using the UrlBuilder class.
Ensure placeholder names in .path() match exactly the keys passed to .build(). For example, path('/users/:userId') requires build({ userId: '...' }) not { userid: '...' }.If you need query parameter encoding, manually encode values before passing to .query() or use a third-party library.
Always provide all parameters defined in the path template to .build(). Optional parameters are not supported.
Update to new UrlBuilder(baseUrl, options) if upgrading from pre-1.0.0 versions.
Pass base URL via constructor: new UrlBuilder('https://example.com', options).Use ESM import: import { UrlBuilder } from 'rest-url-builder'Install the package: npm install rest-url-builder
Provide all parameters defined in the path template to .build().
No dependency data recorded yet.