📜  猫鼬连接 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:23.798000             🧑  作者: Mango

代码示例6
const mongoose = require("mongoose");

//  database connection with mongoose
mongoose.connect("mongodb://localhost/todos", {
        useNewUrlParser: true,
        useUnifiedTopology: true
    })
    .then(() => console.log("connection successful"))
    .catch((err) => console.log(err));