Use TypeScript type inference and IDE autocomplete for comfort and type safety in HTTP constants manipulations.
Summary
The small dependency-free, TypeScript HTTP convenience package. Exposes uniform standardized RFC-compliant type-safe auto-completable HTTP constants to apply across your applications' ends and services along with the convenience functionality (validate, normalize, is among, of group, in group, make, extract, transform etc.).
Package Status
The package is in a usage-ready state, no pending functionality. It is actively maintained. It moves to production-ready >= v1.0.0
as the initial usage feedback confirms it has no major missing use cases.
The pack purpose is to provide uniform standardized RFC-compliant HTTP constants' values for applications across the consumer's entire TypeScript application stack.
It adds the type safety and convenience of auto-complete. It allows to avoid string constants ambiguity, ensures you always get the same correct and uniform HTTP header name (or a MIME type, or a status code / message) sent from your one end (e.g. front) to the other (e.g. back) and / or across you services.
On top it has functionality that allows manipulating the application HTTP variables in a numerous comfortably declarative ways.
Table of Contents
The package is carefully documented for comfortable developer experience.
From the good-named identifiers in code, thought-out autocompletion (see animated GIF demo), hover-popup doc blocks with usage examples on enums, constants classes and methods accessible with on-hover or Ctrl-Left-click
when integrated with your IDE TypeScript setup (e.g. see VS Code) to the detailed readme with use cases and the dedicated modules' API references.
As well there is a GitHub Discussion available for question and requests, as the usual GitHub Issues for bug reporting.
Code Conventions
To ease the readability and autocomplete I apply the following conventions: start interface names with I
, enums with E
, type aliases with T
, generics with G
. Abbreviations are always in caps (satisfactory comfort). The domain-respective public API contains HTTP
prefix to namespace the package members, the module name like Statuses
, Methods
, MIME
etc.
As the names may feel rather long you can apply the imports aliasing like this:
import { EHTTPMethods as EMethods, HTTPMethodsConvenience as Methods } from 'http-convenience-pack';
Hope you appreciate.
npm install http-convenience-pack
Here is the short demo. The autocomplete works on all published API members. See the respective API References in the modules dedicated documentation.
Will come with public updates.
Will appear here when available.
Potentially valuable use cases / functionality suggestions are welcome either in Discussions or as pull requests.
If there is a Pull Request contribution, I would receive it on integration
branch for discussion and manual merge.
This project is licensed under the MIT License - see the LICENSE file for details.