Gathering detailed insights and metrics for snb-mock-middleware
Gathering detailed insights and metrics for snb-mock-middleware
npm install snb-mock-middleware
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
3,327
Last Day
4
Last Week
32
Last Month
59
Last Year
317
11 Commits
1 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.2.21
Package Id
snb-mock-middleware@1.2.21
Unpacked Size
320.92 kB
Size
185.92 kB
File Count
13
NPM Version
6.14.11
Node Version
14.16.0
Cumulative downloads
Total Downloads
Last day
33.3%
4
Compared to previous day
Last week
966.7%
32
Compared to previous week
Last month
1,866.7%
59
Compared to previous month
Last year
-35.6%
317
Compared to previous year
25
1
Mock middleware for mocking restful APIs.
yarn add snb-mock-middleware -D
or
npm install --save-dev snb-mock-middleware
1const express = require('express'); 2const path = require('path'); 3const createtMockMiddleware = require('./dist/index'); 4var app = express(); 5app.use( 6 createtMockMiddleware({ 7 cwd: path.join(__dirname, '/'), 8 }), 9); 10 11const server = app.listen(3000, () => { 12 const host = server.address().address; 13 const port = server.address().port; 14 console.log('Example app listening at http://%s:%s', host, port); 15});
1module.exports = { 2 devServer: { 3 before: (app) => { 4 app.use( 5 createMock({ 6 cwd: path.join(__dirname, '/'), 7 }), 8 ); 9 }, 10 } 11}
For example in file /mock/api.js, you can have content
1const mockjs = require('mockjs'); 2 3const getActivities = [ 4 { 5 id: 'trend-1', 6 updatedAt: new Date(), 7 user: { 8 name: '曲丽丽', 9 }, 10 group: { 11 name: '高逼格设计天团', 12 link: 'http://github.com/', 13 }, 14 project: { 15 name: '六月迭代', 16 link: 'http://github.com/', 17 }, 18 template: '在 @{group} 新建项目 @{project}', 19 }, 20]; 21 22exports.default = { 23 'GET /api/activities': getActivities, 24 'POST /api/forms': (req, res) => { 25 res.send({ message: 'Ok' }); 26 }, 27 'GET /api/tags': mockjs.mock({ 28 'list|100': [{ name: '@city', 'value|1-100': 150, 'type|0-2': 1 }], 29 }), 30}; 31
Move to: issues
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 0/11 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More