{"id":24822229,"url":"https://github.com/montasim/http-status-lite","last_synced_at":"2025-04-12T01:07:50.545Z","repository":{"id":274695563,"uuid":"923785279","full_name":"montasim/http-status-lite","owner":"montasim","description":"A collection of commonly used HTTP status codes for applications. This package helps standardize HTTP status code handling in your project by providing a predefined, immutable set of constants.","archived":false,"fork":false,"pushed_at":"2025-02-12T09:02:44.000Z","size":915,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T01:07:45.108Z","etag":null,"topics":["apache","codes","http","httpclient","httpstatus","module","node","status","status-codes","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/http-status-lite","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/montasim.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-28T20:25:33.000Z","updated_at":"2025-02-12T09:02:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"860c4da4-0792-47f2-8a10-b1723a82832c","html_url":"https://github.com/montasim/http-status-lite","commit_stats":null,"previous_names":["montasim/http-status-lite"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montasim%2Fhttp-status-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montasim%2Fhttp-status-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montasim%2Fhttp-status-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montasim%2Fhttp-status-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/montasim","download_url":"https://codeload.github.com/montasim/http-status-lite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501864,"owners_count":21114683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache","codes","http","httpclient","httpstatus","module","node","status","status-codes","typescript"],"created_at":"2025-01-30T18:27:02.190Z","updated_at":"2025-04-12T01:07:50.539Z","avatar_url":"https://github.com/montasim.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# http-status-lite\r\n\r\n\u003c!-- repository summary badges start --\u003e\r\n\u003cdiv\u003e\r\n    \u003cimg alt=\"NPM Version\" src=\"https://badgen.net/npm/v/http-status-lite?label=version\u0026labelColor=EB008B\u0026color=00B8B5\"\u003e\r\n    \u003cimg alt=\"NPM Downloads\" src=\"https://badgen.net/npm/dm/http-status-lite?label=downloads\u0026labelColor=EB008B\u0026color=00B8B5\"\u003e\r\n    \u003cimg alt=\"NPM Package\" src=\"https://badgen.net/npm/license/http-status-lite?label=license\u0026labelColor=EB008B\u0026color=00B8B5\"\u003e\r\n\u003c/div\u003e\r\n\u003c!-- repository summary badges end --\u003e\r\n\r\nThe [http-status-lite](https://www.npmjs.com/package/http-status-lite) is a lightweight and comprehensive utility providing standardized HTTP status codes for applications. It simplifies the handling of HTTP response codes by offering predefined constants, ensuring clarity and consistency in API responses.\r\n\r\n## Table of Contents\r\n\r\n- [Key Features](#key-features)\r\n- [Installation](#installation)\r\n- [Usage](#usage)\r\n- [HTTP Status Code Categories](#http-status-code-categories)\r\n- [License](#license)\r\n- [Acknowledgments](#acknowledgments)\r\n- [FAQs](#faqs)\r\n\r\n---\r\n\r\n## Key Features\r\n\r\n1. **Predefined HTTP Status Codes:** Provides a comprehensive set of HTTP status codes for easy reference.\r\n2. **TypeScript Support:** Includes strong type definitions for enhanced code safety and developer experience.\r\n3. **Immutable Constants:** Ensures status codes cannot be modified, preventing unintended changes.\r\n4. **Lightweight \u0026 Efficient:** Minimal footprint with high performance.\r\n5. **Easy Integration:** Seamlessly integrates with any Node.js or TypeScript-based project.\r\n\r\n---\r\n\r\n## Installation\r\n\r\nTo install the package, run the following command:\r\n\r\n```bash\r\nnpm install http-status-lite\r\n```\r\n\r\n---\r\n\r\n## Usage\r\n\r\n### CommonJS\r\n\r\n```javascript\r\nconst httpStatusLite = require('http-status-lite');\r\n\r\nconsole.log(httpStatusLite.OK); // Outputs: 200\r\n```\r\n\r\n### Module (ESM)\r\n\r\n```javascript\r\nimport httpStatusLite from 'http-status-lite';\r\n\r\nconsole.log(httpStatusLite.OK); // Outputs: 200\r\n\r\n// TypeScript example:\r\nimport httpStatusLite, { HttpStatusType } from 'http-status-lite';\r\n\r\nconst successStatus: HttpStatusType = 'OK';\r\nconsole.log(httpStatusLite[successStatus]); // Outputs: 200\r\n```\r\n\r\n### Example Usage in an Express.js Application (ESM)\r\n\r\n```javascript\r\nimport httpStatusLite from 'http-status-lite';\r\nconst express = require('express');\r\nconst app = express();\r\n\r\napp.get('/status', (req, res) =\u003e {\r\n    res.status(httpStatusLite.OK).json({ message: 'Server is running!' });\r\n});\r\n\r\napp.listen(3000, () =\u003e console.log('Server running on port 3000'));\r\n```\r\n\r\n---\r\n\r\n## HTTP Status Code Categories\r\n\r\n### **Informational Responses (100–199)**\r\n\r\n- `CONTINUE`: 100\r\n- `SWITCHING_PROTOCOLS`: 101\r\n- `PROCESSING`: 102\r\n- `EARLY_HINTS`: 103\r\n\r\n### **Successful Responses (200–299)**\r\n\r\n- `OK`: 200\r\n- `CREATED`: 201\r\n- `ACCEPTED`: 202\r\n- `NO_CONTENT`: 204\r\n- `PARTIAL_CONTENT`: 206\r\n\r\n### **Redirection Messages (300–399)**\r\n\r\n- `MULTIPLE_CHOICES`: 300\r\n- `MOVED_PERMANENTLY`: 301\r\n- `FOUND`: 302\r\n- `SEE_OTHER`: 303\r\n- `TEMPORARY_REDIRECT`: 307\r\n- `PERMANENT_REDIRECT`: 308\r\n\r\n### **Client Error Responses (400–499)**\r\n\r\n- `BAD_REQUEST`: 400\r\n- `UNAUTHORIZED`: 401\r\n- `FORBIDDEN`: 403\r\n- `NOT_FOUND`: 404\r\n- `METHOD_NOT_ALLOWED`: 405\r\n- `TOO_MANY_REQUESTS`: 429\r\n- `UNAVAILABLE_FOR_LEGAL_REASONS`: 451\r\n\r\n### **Server Error Responses (500–599)**\r\n\r\n- `INTERNAL_SERVER_ERROR`: 500\r\n- `NOT_IMPLEMENTED`: 501\r\n- `BAD_GATEWAY`: 502\r\n- `SERVICE_UNAVAILABLE`: 503\r\n- `GATEWAY_TIMEOUT`: 504\r\n\r\n---\r\n\r\n## License\r\n\r\n[![by-nc-nd/4.0](https://licensebuttons.net/l/by-nc-nd/4.0/88x31.png)](https://creativecommons.org/licenses/by-nc-nd/4.0/)\r\n\r\nThis project is licensed under the **Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)**.\r\n\r\n### You are free to:\r\n\r\n- **Share** — Copy and redistribute the material in any medium or format.\r\n\r\n### Under the following terms:\r\n\r\n- **Attribution** — You must give appropriate credit, provide a link to the license, and indicate if changes were made.\r\n- **NonCommercial** — You may not use the material for commercial purposes.\r\n- **NoDerivatives** — If you remix, transform, or build upon the material, you may not distribute the modified material.\r\n\r\nFor more details, please visit the [Creative Commons License Page](https://creativecommons.org/licenses/by-nc-nd/4.0/).\r\n\r\n---\r\n\r\n## Acknowledgments\r\n\r\nSpecial thanks to the following resources:\r\n\r\n1. **MDN Web Docs** - Comprehensive HTTP status code references.\r\n2. **Node.js Express Documentation** - Guidance on handling HTTP responses.\r\n3. **TypeScript Docs** - Best practices for defining and using type-safe constants.\r\n\r\n---\r\n\r\n## FAQs\r\n\r\n### 1. **How do I determine the correct HTTP status code for my response?**\r\n\r\nHTTP status codes are categorized based on their meaning. Informational (100s), Success (200s), Redirection (300s), Client Errors (400s), and Server Errors (500s). Choose the appropriate category based on your response type.\r\n\r\n### 2. **Can I extend this library with custom status codes?**\r\n\r\nNo, the constants are immutable and follow the official HTTP status codes. If needed, you can create a wrapper module to include your custom codes.\r\n\r\n### 3. **How do I uninstall the package?**\r\n\r\nYou can remove the package by running:\r\n\r\n```bash\r\nnpm uninstall http-status-lite\r\n```\r\n\r\n---\r\n\r\n## Author\r\n\r\n\u003ctable\u003e\r\n  \u003ctr\u003e\r\n    \u003ctd align=\"center\"\u003e\r\n      \u003cimg src=\"https://avatars.githubusercontent.com/u/95298623?v=4\" width=\"100px\" alt=\"Moon\"\u003e\r\n      \u003ca href=\"https://github.com/montasim\"\u003e\r\n        \u003cbr\u003e\r\n          Ｍ♢ＮＴΛＳＩＭ\r\n        \u003c/br\u003e\r\n      \u003c/a\u003e\r\n    \u003c/td\u003e\r\n  \u003c/tr\u003e\r\n\u003c/table\u003e\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmontasim%2Fhttp-status-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmontasim%2Fhttp-status-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmontasim%2Fhttp-status-lite/lists"}