Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sumor/api-middleware

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sumor/api-middleware - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

16

package.json
{
"name": "@sumor/api-middleware",
"description": "API Middleware is a middleware for Node.JS. It can easily expose function to api, and validate parameters",
"version": "1.0.4",
"version": "1.0.5",
"license": "MIT",

@@ -19,5 +19,5 @@ "repository": "sumor-cloud/api-middleware",

"@sumor/config": "^1.3.1",
"@sumor/error": "^1.0.6",
"@sumor/logger": "^1.2.7",
"@sumor/validator": "^1.2.0",
"@sumor/logger": "^1.2.7",
"@sumor/error": "^1.0.6",
"body-parser": "^1.20.1",

@@ -27,4 +27,4 @@ "multer": "^1.4.5-lts.1"

"devDependencies": {
"fs-extra": "^11.2.0",
"@jest/globals": "^29.7.0",
"@sumor/ssl-server": "^1.0.21",
"axios": "^1.6.8",

@@ -35,7 +35,8 @@ "eslint": "^8.57.0",

"eslint-plugin-prettier": "^5.1.3",
"@sumor/ssl-server": "^1.0.21",
"fs-extra": "^11.2.0",
"husky": "^9.0.11",
"jest": "^29.7.0",
"jest-html-reporter": "^3.10.2",
"prettier": "^3.2.5"
"prettier": "^3.2.5",
"serve": "^14.2.3"
},

@@ -61,4 +62,5 @@ "files": [

"prepare": "husky",
"check": "npm run autofix && npm run coverage"
"check": "npm run autofix && npm run coverage",
"view-coverage-report": "serve -l 8080 output/coverage"
}
}

@@ -51,3 +51,3 @@ # api-middleware

2. [Optional] Add a file named `plus.json` in your project folder `api`
2. [Optional] Add a config file named `plus.json` in your project folder `api`

@@ -91,3 +91,52 @@ ```json

### More Config File Types
##### yaml
You can use yaml file to define config file, replace `plus.json` with `plus.yml`
```yaml
name: plus
parameters:
a:
name: parameter a
type: number
length: 3
b:
name: parameter b
type: number
```
##### config.js
For support js function in config file, you can use `config.js` file, replace `plus.json` with `plus.config.js`
```javascript
export default {
name: 'plus',
parameters: {
a: {
name: 'parameter a',
type: 'number',
length: 3
},
b: {
name: 'parameter b',
type: 'number',
rule: [
{
code: 'TOO_BIG',
message: 'b should be less than 100',
function: function (value) {
return value < 100
}
}
]
}
}
}
```
### Parameter Rule
You can reference below example to apply rules to parameters

@@ -94,0 +143,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc