
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
an nextjs api middleware for implementing mock api with reference to umi-mock
next-mock 是一个参考了 umijs 实现了其类似的基于 express 的 mock 中间件,可以方便 nextjs 项目集成
npm install --save-dev next-mock
nextjs 项目 api 目录下创建一个 [...].js 作为示例:import mock from 'next-mock';
import mockjs from 'mockjs';
const getNotice = [
{
id: 'xxx1',
title: titles[0],
logo: avatars[0],
description: '那是一种内在的东西,他们到达不了,也无法触及的',
updatedAt: new Date(),
member: '科学搬砖组',
href: '',
memberLink: '',
},
{
id: 'xxx2',
title: titles[1],
logo: avatars[1],
description: '希望是一个好东西,也许是最好的,好东西是不会消亡的',
updatedAt: new Date('2017-07-24'),
member: '全组都是吴彦祖',
href: '',
memberLink: '',
},
// ...
];
const getActivities = [
{
id: 'trend-1',
updatedAt: new Date(),
user: {
name: '曲丽丽',
avatar: avatars2[0],
},
group: {
name: '高逼格设计天团',
link: 'http://github.com/',
},
project: {
name: '六月迭代',
link: 'http://github.com/',
},
template: '在 @{group} 新建项目 @{project}',
},
{
id: 'trend-2',
updatedAt: new Date(),
user: {
name: '付小小',
avatar: avatars2[1],
},
group: {
name: '高逼格设计天团',
link: 'http://github.com/',
},
project: {
name: '六月迭代',
link: 'http://github.com/',
},
template: '在 @{group} 新建项目 @{project}',
},
// ...
];
function getFakeCaptcha(req, res) {
return res.json('captcha-xxx');
}
export default mock({
'GET /api/project/notice': getNotice,
'GET /api/activities': getActivities,
'POST /api/forms': (req, res) => {
res.send({message: 'Ok'});
},
'GET /api/tags': mockjs.mock({
'list|100': [{name: '@city', 'value|1-100': 150, 'type|0-2': 1}],
}),
// ...
}, (req, res) => {
res.status(404).send({
status: 404,
error: 'Page Not Found',
message: 'No message available',
path: req.url,
});
});
MIT Copyright (c) 2019
FAQs
an nextjs api middleware for implementing mock api with reference to umi-mock
We found that next-mock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.