Lets ctrl + c and ctrl + v our way out of day 9. I'll set up a database for my habit tracker by recycling and adjusting this code.
const mongoose = require ('mongoose');
const db = mongoose.connect('mongodb://localhost/habittracker');
const Habit = require('./models/habitModel');
Created a habitModel.js file in models folder and created my model:
const mongoose = require('mongoose');
const {Schema} = mongoose;
const habitModel = new Schema(
{
done: { type: Boolean, default:false },
title: { type: String},
description: { type: String},
}
);
module.exports = mongoose.model('Habit', habitModel );
It's been an easy ride all through but today is one of those days where i like my PC better when it's off.
Finally, Day 9!
Top comments (0)