Chapter 7: prettier

This commit is contained in:
Beth Griggs
2020-05-20 12:05:00 +01:00
parent a0cf6a254c
commit 85007a6879
12 changed files with 269 additions and 262 deletions
+14 -15
View File
@@ -1,23 +1,22 @@
const mongoose = require('mongoose');
const URI = 'mongodb://localhost:27017/customers'
const mongoose = require("mongoose");
const URI = "mongodb://localhost:27017/customers";
mongoose.connect(URI, {
useNewUrlParser: true,
useUnifiedTopology: true
})
useNewUrlParser: true,
useUnifiedTopology: true,
});
const Customer = mongoose.model('Customer', {
forename: String,
surname: String
})
const Customer = mongoose.model("Customer", {
forename: String,
surname: String,
});
const customer_1 = new Customer({
forename: 'Beth',
surname: 'Griggs'
})
forename: "Beth",
surname: "Griggs",
});
customer_1.save().then((doc) => {
console.log('Added new customer', doc.forename, doc.surname)
})
console.log("Added new customer", doc.forename, doc.surname);
});