open-index/open-npm huggingface dataset:
npm package: @rafikidota/http-exceptions
Description: My own http exceptions library with blackjacks and hookers
Author: rafiki
Latest version: 1.2.0

# HTTP Exceptions
 Just my own http exceptions library with blackjack and hookers

<img 
alt="Bender"
src = "https://github.com/rafikidota/http-exceptions/raw/main/bender.png?raw=true" 
style="width:250px"/>

## npm
 ```bash
npm install @rafikidota/http-exceptions
```

## yarn
 ```bash
yarn add @rafikidota/http-exceptions
```
## pnpm
 ```bash
pnpm add @rafikidota/http-exceptions
```

## Using http exceptions with Express

The following JavaScript code snippet demonstrates an example of using the http exceptions library in conjunction with the Express framework. This code sets up a basic Express server and showcases how to handle HTTP exceptions using the library.

```js
const express = require('express');
const { HttpException, BadRequestException, UnauthorizedException, ForbiddenException, NotFoundException, InternalServerErrorException } = require('@rafikidota/http-exceptions');

const app = express();
const PORT = process.env.PORT || 3000;

app.listen(PORT, () => {
    console.log(`Server listening on port ${PORT}`);
});
```

## HttpException
```js
app.get('/http-exception', (req, res) => {
    throw new HttpException('Not Implemented', 501);
});
```

## BadRequest
```js
app.get('/bad-request', (req, res) => {
    throw new BadRequestException('An bad request example');
});
```

## Unauthorized
```js
app.get('/unauthorized', (req, res) => {
    throw new UnauthorizedException('An unauthorized example');
});
```

## Forbidden
```js
app.get('/forbidden', (req, res) => {
    throw new ForbiddenException('A forbidden example');
});
```

## Not found
```js
app.get('/not-found', (req, res) => {
    throw new NotFoundException('An not found example');
});
```

## Interal Server Error
```js
app.get('/internal-server-error', (req, res) => {
    throw new InternalServerErrorException('An internal server error example');
});
```

## Error handling
```js
app.use((error, req, res, next) => {
    const { name, message, status } = error;
    return res.status(status || 500).json({ name, message, status });
});
```

Explore the code example on GitHub [here](https://github.com/rafikidota/express-http-exceptions/)
npm package: @rafikidota/kashita
Description: Sometimes, the best way to solve your own problems is to help someone else.
Author: rafiki
Latest version: 0.6.0

# Kashita

Sometimes, the best way to solve your own problems is to help someone else.

**Kashita** is a plug-and-play Redis integration library for [NestJS](https://nestjs.com/). It provides a clean, typed, and environment-ready setup to add Redis support in any NestJS app.

## 🔧 Features

- 📦 Easy integration
- 🧪 Typed Redis options
- 🔐 Environment variable validation
- 🧱 Modular structure and extendable design
- 💾 Simple wrapper over `@nestjs/cache-manager` for `Redis`


## 🚀 Getting Started

```ts
import { RedisCacheModule } from '@rafikidota/kashita'

@Module({
  imports: [RedisCacheModule.forRoot()],
})
export class AppModule {}
```

## 🧰 Using the RedisCacheService
You can inject RedisCacheService into any provider or service:

```ts
import { Injectable } from '@nestjs/common';
import { RedisCacheService } from '@rafikidota/kashita';

@Injectable()
export class CacheManagerService {
  constructor(private readonly service: RedisCacheService) {}

  async get<T>(key: string): Promise<T | undefined> {
    return this.service.get<T>(key);
  }

  async set<T>(key: string, value: T, ttl: number): Promise<T> {
    return this.service.set(key, value, ttl);
  }

  async del(key: string): Promise<boolean> {
    return this.service.del(key);
  }

  async clear(): Promise<boolean> {
    return this.service.clear();
  }
}
```


## ⚙️Environment Variables
You can configure Redis via `.env`:

```env
REDIS_URL=REDIS_URL=redis://localhost:6379
CACHEABLE_MEMORY_TTL=60000,
CACHEABLE_MEMORY_LRU_SIZE=5000
```

## 📖Additional Resources
- [NestJS Documentation](https://docs.nestjs.com/)
- [TypeORM Documentation](https://typeorm.io/)
- [Nestjs Iroh example on GitHub](https://github.com/rafikidota/nestjs-iroh/)
npm package: @rafikidota/serpens
Description: Sometimes, the best way to solve your own problems is to help someone else.
Author: rafiki
Latest version: 1.12.0

# TypeORM Snake Naming Strategy

Sometimes, the best way to solve your own problems is to help someone else.

## Using Snake Naming Strategy with TypeORM

The following TypeScript code snippet illustrates an example of using this library with TypeORM.


```ts
import { DataSource } from 'typeorm';
import { DataSourceOptions } from 'typeorm';
import { SnakeNamingStrategy } from '@rafikidota/serpens';

const config: DataSourceOptions = {
    type: 'postgres',
    host: 'localhost',
    port: 5432,
    database: 'postgres',
    username: 'postgres',
    password: 'postgres',
    entities: [__dirname + '/**/*.entity{.ts,.js}'],
    migrations: [__dirname + '/migrations/*{.ts,.js}'],
    synchronize: false,
    namingStrategy: new SnakeNamingStrategy(),
};

export default new DataSource(config);
```

## Prerequisites
Before using this library, ensure you have the following:
- TypeORM configured
- Necessary dependencies installed


## Additional Resources
- [TypeORM Documentation](https://typeorm.io/)