
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
@s7x/base-helpers
Advanced tools
Fast, unopinionated, minimalist web framework for node.
const CrudContollerExpress = require('@s7x/base-helpers');
This is a Node.js module available through the npm registry.
Before installing, download and install Node.js. Node.js 0.10 or higher is required.
Installation is done using the
npm install command:
$ npm install @s7x/base-helpers
Follow our installing guide for more information.
const mongoose = require('mongoose');
const schema = new mongoose.Schema(
{
name: { type: String },
description: { type: String },
isDeleted: { type: Boolean, default: false }
},
{ timestamps: true }
)
module.exports = mongoose.model('Company', schema);
config.js
const { MongoLookup, BaseConfigMongo } = require("@s7x/base-helpers/lib/types");
module.exports = new BaseConfigMongo({
findExact: [ 'name', '_id' ],
searchFields: ['name', 'description'],
defaultMatch: { isDeleted: false },
softDeleteKey: 'isDeleted',
mapping: {},
uniqueKeys: ['name'],
lookups: [
new MongoLookup({
name: 'branches',
from: 'branches',
as: 'branchesData',
localField: '_id',
foreignField: 'branchId',
multi: true
}),
],
defaultSortDirection: -1,
defaultSortKey: 'updatedAt',
});
index.js
const { BaseMongo } = require("@s7x/base-helpers/lib/modules");
const config = require("./config");
const Company = require('../../models/mongo/company');
class Module extends BaseMongo {
constructor() {
super(Company, config);
}
}
module.exports = new Module();
const mainModule = require('../../modules/company');
const CrudContollerExpress = require('@s7x/base-helpers/lib/modules/crud-controller-express');
class Controller extends CrudContollerExpress {
constructor() {
super(mainModule);
}
}
module.exports = new Controller();
const controller = require("./controller");
const CrudApi = require("@s7x/base-helpers/lib/modules/crud-api");
const joi = require("joi");
let crudApi = new CrudApi(controller)
let apiPath = 'companies';
let schema = {
name: joi.string().required(),
description: joi.string().allow('').optional(),
};
let routes = [
crudApi.getCreateApi(schema),
crudApi.getFindAllApi({
...validation.paginator
}),
crudApi.getFindByIdApi(),
crudApi.getUpdateByIdApi(schema),
crudApi.getreplaceByIdApi(schema),
crudApi.getDeleteByIdApi({}, true)
]
module.exports = { basePath: `/${apiPath}`, routes }
FAQs
helpers
We found that @s7x/base-helpers 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
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.