Skip to content

Instantly share code, notes, and snippets.

View foyzulkarim's full-sized avatar
🚀
building awesome stuffs

Foyzul Karim foyzulkarim

🚀
building awesome stuffs
View GitHub Profile
@foyzulkarim
foyzulkarim / index.js
Created July 14, 2021 15:55
Webinar on Node.js : Express.js handle 200K+ request in 10seconds using Cluster and PM2
const express = require('express')
var numCPUs = require('os').cpus().length;
const cluster = require('cluster');
const app = express()
app.get('/', (req, res) => {
res.send('Hello World!')
});
@foyzulkarim
foyzulkarim / usages.js
Created March 3, 2024 12:10
Simplify Express.js Validation: Sync Joi and Mongoose Schemas
const viewModelProps = {
title: { type: String, isRequired: true, minLength: 5, unique: true, index: true },
category: { type: String, isRequired: true },
}
// in mongoose
const videoSchema = new mongoose.Schema({
...generateSchema(true, viewModelProps),
duration: {
type: Number,