Utwórz ślimaka w ekspresie

//4 types of middleware document,query,aggregate and model 
//document middleware run before .save() and .create()
const slugify = require('slugify')

tourSchema.pre('save',function(next) {
     console.log('will save document')
     this.slug= slugify(this.name,{lower:true})
     next()
})
Shirshak kandel