Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Node module to build quickly api, views to display models, easy integration with Backbone, etc.
FastCrud is Node.js module that makes development of CRUD operations faster, allowing to focus on frontend.
It works with Express and Mongoose.
Some features:
you can define a model simply by its default values. It creates automatically from them the corresponding mongoose Schema
you can add API for defined models simply in one line of code. It generates automatically urls and corresponding methods
you can use generic views to automatically generate urls and corresponding http request handlers and focus only on template to display, modify and create models, with just few lines of code. Generic views supported are: ListView (to list instances of a model), DetailsView (to display single model), CreateView and UpdateView
Suppose you have a Student model with nested School model.
Define a model calling FastCrud.Model function and passing an object of default values.
var FastCrud=require('./fastcrud')
var StudentModel=FastCrud.Model({
Student:{
name: 'Giovanni Johnson',
age: 18,
School: {
name: 'Standford',
address: 'Stand street'
}
},
})
You can invoke FastCrud.get(name_of_model) function to get mongoose model. Example:
var Student=FastCrud.get('Student')
, School=FastCrud.get('School')
var school=new School({
name: 'Roma 3',
address: 'via della Vasca Navale'
})
var student=new Student({
name: 'Marco DiLillo',
age: 24,
school: school
}).save(function(err,doc){
console.log(err,doc);
})
Use setAPI(app) of a defined model, it automatically defines url and corresponding methods to handle instances via GET, PUT, POST, DELETE http methods.
StudentModel.setAPI(app)
Generated urls are:
Use setGenericViews(app,options) to quickly define urls and corresponding routes to display models. It automatically generate corresponding urls, like:
Parameters are:
Example:
StudentModel.setGenericViews(app,{
ListView: {
template: './students/students.jade'
},
DetailsView:{
template: './students/student.jade'
}
})
Example of jade templates for ListView:
- for student in models
p
a(href='/student/#{student._id}/') #{student.name}
Example of jade templates for DetailsView:
p Name: #{model.name}
p School: #{model.school[0].name}
FAQs
Node module to build quickly api, views to display models, easy integration with Backbone, etc.
We found that fastcrud 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.