
Research
/Security News
npm Malware Campaign Uses Adspect Cloaking to Deliver Malicious Redirects
Malicious npm packages use Adspect cloaking and fake CAPTCHAs to fingerprint visitors and redirect victims to crypto-themed scam sites.
express-struct
Advanced tools
It defines a strict directories structure for you and maps automatically the routes.
var struct = require('express-struct'),
express = require('express');
var app = express();
struct.setup(app, options);
app.listen(8888);
// /mvc/mymodule/controllers/mycontroller.js
exports.myaction = function(req, res, next) {
// will render /mvc/mymodule/views/mycontroller/myaction.html
res.render();
};
{
// Root directory where mvc is located.
root: process.cwd(),
route: '/:module?/:controller?/:action?(/*)?',
// Convert paths after action into query
// /app/user/create/name/kof -> query = {name: 'kof'}
paramQuery: true,
// Module name used if nothing else passed.
defaultModule: 'index',
// Enabled modules list.
moduleNames: null,
// Error handler.
error: function() {}
}
Default module is defined in options. Default controller is module name. Default action is controller name.
'/mymodule' -> '/mvc/mymodule/controllers/mymodule:mymodule'
'/mymodule/mycontroller' -> '/mvc/mymodule/controllers/mycontroller:mycontroller'
'/mymodule/mycontroller/myaction' -> '/mvc/mymodule/controllers/mycontroller:myaction'
Define exports.CRUD = true; in your controller to support http methods to CRUD mapping for actions.
get: '/mymodule/mycontroller' -> '/mvc/mymodule/controllers/mycontroller:read'
post: '/mymodule/mycontroller' -> '/mvc/mymodule/controllers/mycontroller:create'
put: '/mymodule/mycontroller' -> '/mvc/mymodule/controllers/mycontroller:udpate'
delete: '/mymodule/mycontroller' -> '/mvc/mymodule/controllers/mycontroller:delete'
FAQs
MVC project structure on top of express.
We found that express-struct 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
Malicious npm packages use Adspect cloaking and fake CAPTCHAs to fingerprint visitors and redirect victims to crypto-themed scam sites.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads