@wnodex/cors 0.2.1 → 0.2.2
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.
- package/.turbo/turbo-build.log +2 -2
- package/README.md +68 -5
- package/package.json +9 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
> @wnodex/cors@0.2.
|
|
2
|
+
> @wnodex/cors@0.2.2 build /home/runner/work/wnodex/wnodex/packages/cors
|
|
3
3
|
> rolldown -c && tsc
|
|
4
4
|
|
|
5
5
|
[log] <DIR>/index.js chunk │ size: 1.83 kB
|
|
6
6
|
[log]
|
|
7
|
-
[success] rolldown v1.0.0-rc.1 Finished in
|
|
7
|
+
[success] rolldown v1.0.0-rc.1 Finished in 22.47 ms
|
package/README.md
CHANGED
|
@@ -1,14 +1,77 @@
|
|
|
1
1
|
# @wnodex/cors
|
|
2
2
|
|
|
3
|
-
wnodex cors middleware
|
|
3
|
+
> wnodex cors middleware
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Part of the [wnodex](https://github.com/wnodex/wnodex) ecosystem, this package provides CORS middleware for `wnodex`.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## About
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
`@wnodex/cors` integrates the `cors` middleware to enable Cross-Origin Resource Sharing (CORS) in your `wnodex` application. It allows you to control which origins can access your API.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Enable and configure CORS from the main `wnodex` configuration.
|
|
14
|
+
- Fine-grained control over `origin`, `methods`, `allowedHeaders`, and other CORS options.
|
|
15
|
+
- Uses the battle-tested `cors` library for Express.
|
|
16
|
+
|
|
17
|
+
## Why use it?
|
|
18
|
+
|
|
19
|
+
This package provides a standardized way to manage CORS settings within a `wnodex` project. It helps prevent common cross-origin issues during development and allows you to enforce strict security policies in production, all from one central configuration point.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
You can install the package using your favorite package manager:
|
|
24
|
+
|
|
25
|
+
**pnpm**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm add @wnodex/cors
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**npm**
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install @wnodex/cors
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**yarn**
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
yarn add @wnodex/cors
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**bun**
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
bun add @wnodex/cors
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
`@wnodex/cors` is enabled by default with sensible settings for development. You can customize its behavior by passing a `cors` object to the `Wnodex` constructor.
|
|
52
|
+
|
|
53
|
+
To disable it, set `cors` to `false`.
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { Wnodex } from 'wnodex';
|
|
57
|
+
|
|
58
|
+
// Example: Customize allowed origins
|
|
59
|
+
const server = new Wnodex({
|
|
60
|
+
cors: {
|
|
61
|
+
origin: 'https://my-frontend-app.com',
|
|
62
|
+
methods: ['GET', 'POST'],
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Example: Disable CORS
|
|
67
|
+
const serverWithDisabledCors = new Wnodex({
|
|
68
|
+
cors: false,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
server.start();
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The options object is passed directly to the `cors` library.
|
|
12
75
|
|
|
13
76
|
## License
|
|
14
77
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wnodex/cors",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "wnodex
|
|
5
|
+
"description": "A wnodex middleware that integrates CORS to enable Cross-Origin Resource Sharing.",
|
|
6
6
|
"keywords": [
|
|
7
|
-
"wnodex"
|
|
7
|
+
"wnodex",
|
|
8
|
+
"middleware",
|
|
9
|
+
"cors",
|
|
10
|
+
"express",
|
|
11
|
+
"security",
|
|
12
|
+
"origin"
|
|
8
13
|
],
|
|
9
14
|
"homepage": "https://github.com/wnodex/wnodex#readme",
|
|
10
15
|
"bugs": {
|
|
@@ -39,7 +44,7 @@
|
|
|
39
44
|
"@types/node": "^25.0.10",
|
|
40
45
|
"rolldown": "1.0.0-rc.1",
|
|
41
46
|
"typescript": "5.9.2",
|
|
42
|
-
"@wnodex/typescript-config": "0.2.
|
|
47
|
+
"@wnodex/typescript-config": "0.2.2"
|
|
43
48
|
},
|
|
44
49
|
"publishConfig": {
|
|
45
50
|
"access": "public"
|