简体   繁体   中英

Mongodb Node.js : socket.io

I have developed a chat application with socket.io with mongodb but still I have a doubt Could I use socket.io with mongodb to build a consultant forum website. If not then why?

You can use

const mongoose = require('mongoose'); 

mongoose.connect('mongodb://localhost:PORT/DATABASE', (err) => {
  if(err){
    console.log("error" + err);
  } else{
    console.log("mongodb connected");
  }
})

It must be done. Mongoose is a good library to connect MongoDB with Node.js.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM