Multi tenant application using Typescript, Express and MongoDB

Mutli tenant application structure.
public mongoUrl: string = 'mongodb://localhost/';mongoose.connect(this.mongoUrl, {   useNewUrlParser: true,});
public addNewStudent(req: Request, res: Response) {const collegeName = req.get('COLLEGE_NAME');const Student = StudentModel.createModel(collegeName, '2020');let newStudent = new Student(req.body);newStudent.save((err, student) => {if (err) {res.send(err);}res.json(student);});}

--

--

--

Providing simple solutions for complex problems.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Running Apollo Server

Micro-Frontend using Web Components

Mongoose, Schemas, Models

My Financial Panel Project

Mysterious React JS

Responsive Styled Components in 3 Minutes (and 18 lines of code)

Using ES6 import on web front side

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Prince Francis

Prince Francis

Providing simple solutions for complex problems.

More from Medium

NoSQL Database with MongoDB

Learned MVC pattern in node JS

Introduction to Node Js and RESTful services.

SE3050 -Application Frameworks Blog — 03