crud-api-express 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/readme.md +36 -24
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crud-api-express",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
package/readme.md CHANGED
@@ -13,11 +13,14 @@ npm install crud-api-express
13
13
 
14
14
  This project provides a flexible and reusable CRUD (Create, Read, Update, Delete) API controller for MongoDB using Express.js and Mongoose.
15
15
 
16
- ## Support Me!
16
+ ## Support Me! ❤️
17
17
 
18
- For Your Support [Visit](https://buymeacoffee.com/mrider007).
18
+ If you find this package useful, consider supporting me:
19
+ [Buy Me a Coffee ☕](https://buymeacoffee.com/mrider007)
19
20
 
20
- ## Table of Contents
21
+ ---
22
+
23
+ ## 📌 Table of Contents
21
24
 
22
25
  - [Introduction](#introduction)
23
26
  - [Installation](#installation)
@@ -28,11 +31,15 @@ For Your Support [Visit](https://buymeacoffee.com/mrider007).
28
31
  - [Contributing](#contributing)
29
32
  - [License](#license)
30
33
 
31
- ## Introduction
34
+ ---
35
+
36
+ ## 🚀 Introduction
32
37
 
33
38
  The `CrudController` class simplifies the creation of RESTful APIs in Node.js applications using MongoDB. It abstracts away common CRUD operations, error handling, middleware integration, and supports custom routes and aggregation pipelines.
34
39
 
35
- ## Usage
40
+ ---
41
+
42
+ ## 🔧 Usage
36
43
 
37
44
  Here's a basic example of how to use `CrudController`:
38
45
 
@@ -124,29 +131,34 @@ mongoose
124
131
  });
125
132
  ```
126
133
 
127
- ## API
134
+ ---
128
135
 
129
- ### Methods
136
+ ## 📖 API
130
137
 
131
- #### `getRouter(): Router`
138
+ ### `getRouter(): Router`
132
139
  Returns the Express Router instance configured with CRUD routes.
133
140
 
134
- ## Options
141
+ ---
142
+
143
+ ## ⚙️ Options
144
+
135
145
 
136
146
  ### `CrudOptions<T>`
137
147
 
138
- | Option | Type | Description |
139
- |----------------|--------------------------------------------------------------------------------------------|-------------------------------------------------------|
140
- | `middleware` | `((req: Request, res: Response, next: NextFunction) => void)[]` | Array of middleware functions |
141
- | `onSuccess` | `(res: Response, method: string, result: T | T[]) => void` | Success handler function |
142
- | `onError` | `(res: Response, method: string, error: Error) => void` | Error handler function |
143
- | `methods` | `('POST' | 'GET' | 'PUT' | 'DELETE')[]` | Array of HTTP methods to support |
144
- | `relatedModel` | `Model<any>` | Related Mongoose model for relational operations |
145
- | `relatedField` | `string` | Field name for related models |
146
- | `relatedMethods` | `('POST' | 'GET' | 'PUT' | 'DELETE')[]` | Methods to apply on related models |
147
- | `aggregatePipeline` | `object[]` | MongoDB aggregation pipeline stages |
148
- | `customRoutes` | `{ method: 'post' | 'get' | 'put' | 'delete', path: string, handler: (req, res) => void }[]` | Array of custom route definitions |
149
-
150
- ## License
151
-
152
- This project is licensed under the ISC License.
148
+ | Option | Type | Description |
149
+ |--------------------|---------------------------------------------------------------------------------------------------------|------------------------------------------------------|
150
+ | `middleware` | `((req: Request, res: Response, next: NextFunction) => void)[]` | Array of middleware functions |
151
+ | `onSuccess` | `(res: Response, method: string, result: T \| T[]) => void` | Success handler function |
152
+ | `onError` | `(res: Response, method: string, error: Error) => void` | Error handler function |
153
+ | `methods` | `('POST' \| 'GET' \| 'PUT' \| 'DELETE')[]` | Array of HTTP methods to support |
154
+ | `relatedModel` | `Model<any>` | Related Mongoose model for relational operations |
155
+ | `relatedField` | `string` | Field name for related models |
156
+ | `relatedMethods` | `('POST' \| 'GET' \| 'PUT' \| 'DELETE')[]` | Methods to apply on related models |
157
+ | `aggregatePipeline` | `object[]` | MongoDB aggregation pipeline stages |
158
+ | `customRoutes` | `{ method: 'post' \| 'get' \| 'put' \| 'delete', path: string, handler: (req: Request, res: Response) => void }[]` | Array of custom route definitions |
159
+
160
+ ---
161
+
162
+ ## 📜 License
163
+
164
+ This project is licensed under the **ISC License**.