cors-extend
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "cors-extend", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Configure the Cors Options with Ease", | ||
@@ -15,3 +15,3 @@ "main": "dist/index.js", | ||
"build:dev": " sudo npm link && cd ./testApp && npm link cors-extended && cd ../", | ||
"test:coverage": "dotenv -v ENVIRONMENT=test jest --coverage --coverageReporters='text-summary' --watchAll", | ||
"test:coverage": "dotenv -v ENVIRONMENT=test jest --coverage --coverageReporters='text-summary'", | ||
"start:dev": "ts-node-dev ./src/index.ts", | ||
@@ -33,3 +33,7 @@ "format": "prettier --write \"src/**\"", | ||
}, | ||
"keywords": ["cors","environment","express"], | ||
"keywords": [ | ||
"cors", | ||
"environment", | ||
"express" | ||
], | ||
"author": "Sankalpa Fernando", | ||
@@ -39,6 +43,3 @@ "license": "MIT", | ||
"cors": "^2.8.5", | ||
"dotenv": "^16.0.0", | ||
"dotenv-cli": "^5.0.0", | ||
"express": "^4.17.3", | ||
"lint-staged": "^12.3.5", | ||
"lodash": "^4.17.21" | ||
@@ -51,2 +52,6 @@ }, | ||
"@types/lodash": "^4.14.179", | ||
"dotenv": "^16.0.0", | ||
"dotenv-cli": "^5.0.0", | ||
"jest": "^27.5.1", | ||
"lint-staged": "^12.3.5", | ||
"pre-commit": "^1.2.2", | ||
@@ -61,4 +66,6 @@ "prettier": "^2.5.1", | ||
"lint-staged": { | ||
"*": [ | ||
"npm test" | ||
], | ||
"src/**": [ | ||
"npm test", | ||
"npm run format", | ||
@@ -70,3 +77,3 @@ "npm run lint", | ||
}, | ||
"pre-commit": "lint-staged" | ||
"pre-commit": "lint-staged -p false" | ||
} |
@@ -1,2 +0,2 @@ | ||
# cors-extend | ||
# Cors-Extend | ||
@@ -7,3 +7,3 @@ Cors-extend is a package which provides the configuration to the existing [Cors](http://www.senchalabs.org/connect/) nodejs package and which enables to configure cors according to the environments. | ||
- [cors-extend](#cors-extend) | ||
- [Cors-Extend](#cors-extend) | ||
- [Installation](#installation) | ||
@@ -25,21 +25,21 @@ - [Usage](#usage) | ||
import cors from "cors"; | ||
import { corsextend } from "cors-extend"; | ||
import { corsExtend } from "cors-extend"; | ||
cors( | ||
corsextend({ | ||
corsExtend({ | ||
env: { | ||
development: { | ||
origins: [ | ||
{ | ||
origin: "http://localhost:3000", | ||
methods: ["GET"], | ||
}, | ||
], | ||
routes: [ | ||
{ | ||
endpoint: "/characters", | ||
methods: ["GET", "POST"], | ||
origins: ["http://localhost:5000"], | ||
}, | ||
], | ||
origins: [ | ||
{ | ||
origin: "http://localhost:3000", | ||
methods: ["GET"], | ||
}, | ||
], | ||
routes: [ | ||
{ | ||
endpoint: "/characters", | ||
methods: ["GET", "POST"], | ||
origins: ["http://localhost:5000"], | ||
}, | ||
], | ||
}, | ||
@@ -56,3 +56,3 @@ }, | ||
Cors-extend is capable of loading specific configuration according to Environment variable, **ENVIRONMENT**. The variable can be pass either by dotenv cli, .env file or any other way. | ||
Cors-Extend is capable of loading specific configuration according to Environment variable, **ENVIRONMENT**. The variable can be pass either by dotenv cli, .env file or any other way. | ||
@@ -65,3 +65,3 @@ `Note` that both environment variable value and configuration name should be equal\* | ||
```javascript | ||
cors(corsextend({ | ||
cors(corsExtend({ | ||
env{ | ||
@@ -96,8 +96,8 @@ development:{ | ||
development: { | ||
origins: [ | ||
{ | ||
origin: "http://localhost:3000", | ||
methods: ["GET"], | ||
}, | ||
]; | ||
origins: [ | ||
{ | ||
origin: "http://localhost:3000", | ||
methods: ["GET"], | ||
}, | ||
]; | ||
} | ||
@@ -104,0 +104,0 @@ } |
3
7986
15
4
49
- Removeddotenv@^16.0.0
- Removeddotenv-cli@^5.0.0
- Removedlint-staged@^12.3.5
- Removedaggregate-error@3.1.0(transitive)
- Removedansi-escapes@4.3.2(transitive)
- Removedansi-regex@5.0.16.1.0(transitive)
- Removedansi-styles@4.3.06.2.1(transitive)
- Removedastral-regex@2.0.0(transitive)
- Removedbraces@3.0.3(transitive)
- Removedclean-stack@2.2.0(transitive)
- Removedcli-cursor@3.1.0(transitive)
- Removedcli-truncate@2.1.03.1.0(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedcolorette@2.0.20(transitive)
- Removedcommander@9.5.0(transitive)
- Removedcross-spawn@7.0.6(transitive)
- Removeddebug@4.4.0(transitive)
- Removeddotenv@16.4.7(transitive)
- Removeddotenv-cli@5.1.0(transitive)
- Removeddotenv-expand@8.0.3(transitive)
- Removedeastasianwidth@0.2.0(transitive)
- Removedemoji-regex@8.0.09.2.2(transitive)
- Removedexeca@5.1.1(transitive)
- Removedfill-range@7.1.1(transitive)
- Removedget-stream@6.0.1(transitive)
- Removedhuman-signals@2.1.0(transitive)
- Removedindent-string@4.0.0(transitive)
- Removedis-fullwidth-code-point@3.0.04.0.0(transitive)
- Removedis-number@7.0.0(transitive)
- Removedis-stream@2.0.1(transitive)
- Removedisexe@2.0.0(transitive)
- Removedlilconfig@2.0.5(transitive)
- Removedlint-staged@12.5.0(transitive)
- Removedlistr2@4.0.5(transitive)
- Removedlog-update@4.0.0(transitive)
- Removedmerge-stream@2.0.0(transitive)
- Removedmicromatch@4.0.8(transitive)
- Removedmimic-fn@2.1.0(transitive)
- Removedminimist@1.2.8(transitive)
- Removednormalize-path@3.0.0(transitive)
- Removednpm-run-path@4.0.1(transitive)
- Removedonetime@5.1.2(transitive)
- Removedp-map@4.0.0(transitive)
- Removedpath-key@3.1.1(transitive)
- Removedpicomatch@2.3.1(transitive)
- Removedpidtree@0.5.0(transitive)
- Removedrestore-cursor@3.1.0(transitive)
- Removedrfdc@1.4.1(transitive)
- Removedrxjs@7.8.1(transitive)
- Removedshebang-command@2.0.0(transitive)
- Removedshebang-regex@3.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedslice-ansi@3.0.04.0.05.0.0(transitive)
- Removedstring-argv@0.3.2(transitive)
- Removedstring-width@4.2.35.1.2(transitive)
- Removedstrip-ansi@6.0.17.1.0(transitive)
- Removedstrip-final-newline@2.0.0(transitive)
- Removedsupports-color@9.4.0(transitive)
- Removedthrough@2.3.8(transitive)
- Removedto-regex-range@5.0.1(transitive)
- Removedtslib@2.8.1(transitive)
- Removedtype-fest@0.21.3(transitive)
- Removedwhich@2.0.2(transitive)
- Removedwrap-ansi@6.2.07.0.0(transitive)
- Removedyaml@1.10.2(transitive)