diff --git a/changelog.md b/changelog.md index d7e3217..4e00f7e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,12 @@ # Changelog +## 2024-12-26 - 1.0.31 - fix(npm) +Corrected project description and added keywords in package.json and npmextra.json. + +- Updated package.json description to align with project architecture. +- Added keywords array in package.json to enhance discoverability. +- Synchronized npmextra.json description and keywords with package.json. + ## 2024-12-26 - 1.0.30 - fix(test) Added basic test for NullResolve instance creation, start, and stop. diff --git a/npmextra.json b/npmextra.json index 7bfd6b7..c3ebe89 100644 --- a/npmextra.json +++ b/npmextra.json @@ -15,9 +15,26 @@ "githost": "gitlab.com", "gitscope": "losslessone/services/servezone", "gitrepo": "nullresolve", - "description": "servezone service. the null service takes care of handling requests and giving feedback for those that would otherwise not be served.", + "description": "The nullresolve project is a private service designed to handle requests that would otherwise remain unserved, providing appropriate feedback mechanisms within the servzone architecture.", "npmPackagename": "@losslessone_private/nullresolve", - "license": "MIT" + "license": "MIT", + "keywords": [ + "nullresolve", + "service", + "request-handling", + "error-management", + "network-ecosystem", + "typescript", + "server", + "feedback", + "private-package", + "npm", + "logging", + "monitoring", + "graceful-shutdown", + "custom-routes", + "error-handling" + ] } } } \ No newline at end of file diff --git a/package.json b/package.json index e23b786..eec1a2e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@losslessone_private/nullresolve", "version": "1.0.30", - "description": "servezone service. the null service takes care of handling requests and giving feedback for those that would otherwise not be served.", + "description": "The nullresolve project is a private service designed to handle requests that would otherwise remain unserved, providing appropriate feedback mechanisms within the servzone architecture.", "type": "module", "author": "Lossless GmbH", "license": "UNLICENSED", @@ -50,5 +50,22 @@ "bugs": { "url": "https://gitlab.com/losslessone/services/servezone/nullresolve/issues" }, - "homepage": "https://gitlab.com/losslessone/services/servezone/nullresolve#readme" -} + "homepage": "https://gitlab.com/losslessone/services/servezone/nullresolve#readme", + "keywords": [ + "nullresolve", + "service", + "request-handling", + "error-management", + "network-ecosystem", + "typescript", + "server", + "feedback", + "private-package", + "npm", + "logging", + "monitoring", + "graceful-shutdown", + "custom-routes", + "error-handling" + ] +} \ No newline at end of file diff --git a/readme.md b/readme.md index 25cee85..f4f9b84 100644 --- a/readme.md +++ b/readme.md @@ -1,43 +1,166 @@ -# @losslessone/services/servezone/nullresolve +# @losslessone_private/nullresolve -servezone service. the null service takes care of handling requests and giving feedback for those that would otherwise not be served. +The nullresolve is a robust service designed to manage and handle requests effectively within the servzone architecture. It ensures requests that would normally remain unserved receive appropriate handling and feedback. -## Availabililty and Links +## Install -- [npmjs.org (npm package)](https://www.npmjs.com/package/@losslessone_private/nullresolve) -- [gitlab.com (source)](https://gitlab.com/losslessone/services/servezone/nullresolve) -- [github.com (source mirror)](https://github.com/losslessone/services/servezone/nullresolve) -- [docs (typedoc)](https://losslessone/services/servezone.gitlab.io/nullresolve/) +To install the `@losslessone_private/nullresolve` package, it is essential to first set up a proper environment for handling private npm packages due to its private nature. This can be achieved through npm or yarn, which are both suitable JavaScript package managers. -## Status for master +### Step-by-Step Installation: -| Status Category | Status Badge | -| ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| GitLab Pipelines | [![pipeline status](https://gitlab.com/losslessone/services/servezone/nullresolve/badges/master/pipeline.svg)](https://lossless.cloud) | -| GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/losslessone/services/servezone/nullresolve/badges/master/coverage.svg)](https://lossless.cloud) | -| npm | [![npm downloads per month](https://badgen.net/npm/dy/@losslessone_private/nullresolve)](https://lossless.cloud) | -| Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/losslessone/services/servezone/nullresolve)](https://lossless.cloud) | -| TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) | -| node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) | -| Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) | -| PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@losslessone_private/nullresolve)](https://lossless.cloud) | -| PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@losslessone_private/nullresolve)](https://lossless.cloud) | -| BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@losslessone_private/nullresolve)](https://lossless.cloud) | -| Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud) | +1. **Ensure you are logged into npm** with sufficient permissions to access private packages: + ```bash + npm login + ``` + Authentication is necessary for accessing private modules like `@losslessone_private/nullresolve`. + +2. **Install Using npm:** + ```bash + npm install @losslessone_private/nullresolve + ``` + If you are using a specific registry for your company or project, make sure to specify it in your npm configuration. + +3. **Install Using Yarn:** + ```bash + yarn add @losslessone_private/nullresolve + ``` + +After these steps, the module should be ready for use in your JavaScript or TypeScript project. ## Usage -## Contribution +The purpose of `nullresolve` is pivotal within a network ecosystem, particularly one that interfaces directly with user requests and external resources. Below, a comprehensive guide exists to demonstrate effective usage of this module within applications. -We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) +### Quick Start Example -## Contribution +Initialization and launching of a nullresolve service can be done succinctly: -We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) +```typescript +// Import the NullResolve class from the package +import { NullResolve } from '@losslessone_private/nullresolve'; -For further information read the linked docs at the top of this readme. +// Create an instance of NullResolve +const myNullResolveService = new NullResolve(); -> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) -> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) +// Start the service +myNullResolveService.start().then(() => { + console.log('NullResolve service is running!'); +}).catch((error) => { + console.error('Error starting NullResolve service:', error); +}); -[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com) +// Stop the service gracefully +process.on('SIGINT', async () => { + await myNullResolveService.stop(); + console.log('NullResolve service stopped.'); + process.exit(0); +}); +``` + +### Detailed Guide: Handling Requests and Custom Routes + +`nullresolve` can swiftly handle complex request scenarios utilizing its robust framework. Here's a detailed example of setting up custom handler routes that can respond with various HTTP statuses or custom messages based on the request: + +```typescript +import { NullResolve } from '@losslessone_private/nullresolve'; + +// Initialize the service +const myService = new NullResolve(); + +// Start the service with custom routes +myService.serviceServer.addCustomRoutes(async (server) => { + server.addRoute( + '/error/:code', + new plugins.typedserver.servertools.Handler('GET', async (req, res) => { + let message; + switch (req.params.code) { + case '404': + message = 'This resource was not found.'; + break; + case '500': + message = 'Internal Server Error. Please try later.'; + break; + default: + message = 'An unexpected error occurred.'; + } + res.status(200).send(`