Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
该项目目前处于开发阶段
.
npm install mvcify
yarn add mvcify
应用目录结构如下:
project
|
|- apps # 应用目录
| |- front-end # 网站前端
| | |- controllers # 控制器
| | | |- index.js # - index控制器
| | | |- user.js # - user控制器
| | | `- ...
| | |- services # 中间件目录
| | |- assets # 静态资源目录
| | |- views # 视图目录
| | |- config.js # 配置
| | `- ...
| `- ...
|- assets
|- node_modules
|- services
|- config.js
|- app.js
|- package.json
`- ...
四行代码轻松启动你的web应用。
// app.js
const mvcify = require('mvcify');
const mvc = mvcify.create(__dirname);
mvc.setup({'front-end': '/'});
mvc.app.listen(8080);
程序定义了一些列的指令,作用于控制器的annotation内,轻松实现路由注册,这样 方便开发、路由与方法绑定及查询,具体指令有:
- get('/path')
- post('/path')
- put('/path')
- patch('/path')
- delete('/path')
- head('/path')
- options('/path')
- route(["method1","method2"], path="/path")
另外,annotation还支持使用下列指令注册中间件:
- before("services目录下的中间件文件名")
- after("services目录下的中间件文件名")
可以多次调用,表示注册多个service 值得注意的是:前一个指令依赖后一个指令是否调用next方法
HTTP方法指令优先级高于route指令,也就是说如果存在HTTP方法指令,则route中对应的的方法无效
// index.js
/**
* 这里的route时必须的
*
* @route("/");
* @before("serviceName");
* @before("serviceName2");
* @after("serviceName")
*/
class IndexController {
constructor(app) {
this.app = app;
}
/**
* 通过before指令注册的service会在该方法前被执行;
* 该方法执行了next,才会执行通过after注册的service
*
* @get("/");
* @before("serviceName");
* @after("serviceName")
*/
index (req, res, next) {
console.log(__filename);
res.render('index', {
title: 'Mvcify',
message: 'Hello world!'
});
}
/**
* route指令中由GET、POST、DELETE、UEF四个方法,其中UEF是不被支持的;
* 另外,又使用了 get、post指令,route中的GET、POST方法则无效了。
*
* @route(["GET", 'post', "Delete", 'UEF']);
* @get("/oo");
* @post("/ii");
*/
about(req, res) {
res.send('sdnjcjkd');
}
}
module.exports = IndexController;
FAQs
simple mvc framework
The npm package mvcify receives a total of 1 weekly downloads. As such, mvcify popularity was classified as not popular.
We found that mvcify 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.